Skip to content
Snippets Groups Projects
README.md 8.78 KiB
Newer Older
  • Learn to ignore specific revisions
  • Anjan Chanda's avatar
    Anjan Chanda committed
    # map-topology
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    This package provides the **topologyd** daemon.
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    ## Overview
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    The **topologyd** daemon constructs full topology of a IEEE1905 enabled Multi-AP network.
    It provides the `topology` UBUS object and methods ( *see UBUS API section below* ) for building and showing the full topology of a network.
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    **topologyd** uses IEEE1905 AL macaddress of a node, where it is running, as the starting (or Root) node. It then discovers it's immediate neighbors, the next-hop neighbors, the next to next-hop neighbors, and so on... until there are no more neighbor nodes in the network, to build the full topology around the starting node.
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    >By default, **topologyd** rebuilds the topology every 60 seconds.
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    To (re)build topology, the UBUS method "*refresh*" can be used. See Usage below -
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    Following algorithm is used to build the full topology -
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    ````
    At any node 'P' in the network:
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    Intial state :
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    Nbr(P) = {N0,..Nn}  <== immediate neighbors of P.
    G{P, N0,..Nn} <== graph of all known nodes at P.
    
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    Step 1 :
    	for all Ni in G :
    		Send Topology Request to Ni.
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    Step 2 :
    	Read Topology Response from Ni.
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    	if Nbr(Ni) is not in G :
    		Insert Nbr(Ni) in G
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    Step 3 :
    	Repeat Step 1-2 until no new Nbr(Ni) can be inserted in 'G'.
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    ````
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    ### UBUS API
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    map-topology provides the `topology` UBUS object with following methods :
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    ````bash
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    'topology' @fc2af0e9
            "refresh":{}
            "status":{}
    
    Anjan Chanda's avatar
    Anjan Chanda committed
            "changelog":{}
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    ````
    
    ### Usage
    
    ````bash
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    #To (re)build topology -
    root@iopsys:~$ ubus call topology refresh
    
    #To get status (can be "incomplete" or "available") -
    root@iopsys:~$ ubus call topology status
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    {
    
    Anjan Chanda's avatar
    Anjan Chanda committed
            "status": "incomplete"
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    }
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    #To show current topology -
    
    root@iopsys:# ubus call topology dump
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    {
    
            "self": {
                    "ieee1905_macaddr": "00:22:07:70:f5:6c",
                    "num_neighbors": 1,
                    "neighbors": [
                            {
                                    "nbr_mac_id": "00:22:07:6e:d8:08"
                            }
                    ],
                    "num_non1905_neighbors": 3,
                    "non1905_neighbors": [
                            "00:22:07:6d:3d:8e",
                            "00:22:07:6d:3d:90",
                            "b0:5c:da:5d:9e:19"
                    ]
            },
            "nodes": [
    
    Vivek Dutta's avatar
    Vivek Dutta committed
                    {
    
                            "ieee1905_macaddr": "00:22:07:6e:d8:08",
                            "num_neighbors": 1,
    
    Vivek Dutta's avatar
    Vivek Dutta committed
                            "neighbors": [
    
                                    {
                                            "nbr_mac_id": "00:22:07:70:f5:6c",
                                            "link_metrics": [
                                                    {
                                                            "nbr_intf_macid": "00:22:07:70:f5:6c",
                                                            "ieee_bridge": 1,
                                                            "tx_packet_error": 0,
                                                            "tx_packet_ok": 1081,
                                                            "mac_thrput_capacity": 0,
                                                            "link_availability": 100,
                                                            "phy_rate": 0,
                                                            "rx_packet_error": 0,
                                                            "rx_packet_ok": 2265,
                                                            "rssi": 0
                                                    }
                                            ]
                                    }
                            ],
                            "num_non1905_neighbors": 1,
                            "non1905_neighbors": [
                                    "b0:5c:da:5d:9e:19"
                            ],
                            "registrar_freq_band": "802.11 2.4 GHz,802.11 5 GHz",
                            "non1905_nbr_localintf": "00:22:07:6e:d8:08",
                            "1905_nbr_localintf": "00:22:07:6e:d8:08",
                            "local_interface_nbr": 3,
                            "interfaces": [
                                    {
                                            "interface_id": "00:22:07:6e:d8:09",
                                            "media_type": "IEEE 802.11ac",
                                            "network_membership": "00:22:07:6e:d8:09",
                                            "role": "AP",
                                            "ap_channel_band": 2,
                                            "freq_index1": 60,
                                            "freq_index2": 0
                                    },
                                    {
                                            "interface_id": "00:22:07:6e:d8:0a",
                                            "media_type": "IEEE 802.11n 2.4",
                                            "network_membership": "00:22:07:6e:d8:0a",
                                            "role": "AP",
                                            "ap_channel_band": 0,
                                            "freq_index1": 11,
                                            "freq_index2": 0
                                    },
                                    {
                                            "interface_id": "00:22:07:6e:d8:08",
                                            "media_type": "IEEE 802.3ab"
                                    }
                            ],
                            "l2_neighbor_num": 2,
                            "l2_neighbor": [
                                    {
                                            "local_intf_id": "00:22:07:6e:d8:08",
                                            "local_nbr_id": "00:22:07:70:f5:6c"
                                    },
                                    {
                                            "local_intf_id": "00:22:07:6e:d8:08",
                                            "local_nbr_id": "b0:5c:da:5d:9e:19"
                                    }
                            ],
    
                            "bridging_tuple_num": 1,
    
                            "bridge_tuple": [
    
                                {
                                        "br_mac": [
                                                "00:22:07:6e:d8:09",
                                                "00:22:07:6e:d8:0a",
                                                "00:22:07:6e:d8:08"
                                        ]
                                }
    						],
    
                            "version": "1905.1a",
                            "friendly_name": "iopsysWrt",
                            "manufacturer_name": "IOPSYS",
                            "manufacturer_model": "EG400R0",
                            "control_url": "http://192.168.1.1",
                            "ipv4_itfr_num": 1,
                            "ipv4_params": [
                                    {
                                            "mac_address": "00:22:07:6e:d8:08",
                                            "ipv4_addr_type": "IPV4_DHCP",
                                            "ipv4_address": "192.168.1.1",
                                            "dhcp_addr": "127.1.1.1"
                                    }
    
    Vivek Dutta's avatar
    Vivek Dutta committed
                            ],
    
                            "ipv6_itfr_num": 0,
                            "ipv6_params": [
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    }
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    #To show the topology changelogs -
    
    root@iopsys:# ubus call topology changelog
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    {
    
            "num_changelog": 2,
            "changelog": [
                    {
                            "reporter": "00:22:07:6e:d8:08",
                            "reporter_interface": "00:22:07:6e:d8:08",
                            "neighbor": "00:22:07:6e:d8:08",
                            "is1905_neighbor": "true",
                            "event_type": "add",
                            "timestamp": "2020-08-25T12:02:46"
                    },
                    {
                            "reporter": "00:22:07:6e:d8:08",
                            "reporter_interface": "00:22:07:6e:d8:08",
                            "neighbor": "b0:5c:da:5d:9e:19",
                            "is1905_neighbor": "false",
                            "event_type": "add",
                            "timestamp": "2020-08-25T12:09:24"
                    }
            ]
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    }
    
    #To show the topology nodes macaddress -
    root@iopsys:# ubus call topology nodes
    {
            "ieee1905_macaddr": "00:22:07:70:f5:6c",
            "neighbors": [
                    "00:22:07:6e:d8:08",
                    "00:22:07:6d:3d:8e"
            ]
    }
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    ````
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    ### Testing
    
    
    Anjan Chanda's avatar
    Anjan Chanda committed
    - Tested with two IEEE1905 devices in the network.
    - Tested with only one IEEE1905 AL macaddress interface.
    
    Vivek Dutta's avatar
    Vivek Dutta committed
    
    ### Dependencies
    
    To successfully build map-topology, the following libraries are needed:
    
    | Dependency        | Link                                       			| License        |
    | ----------------- | ---------------------------------------------------------------- 	| -------------- |
    | libubox    	    | https://git.openwrt.org/project/libubox.git 			| BSD            |
    | libubus     	    | https://git.openwrt.org/project/ubus.git    			| LGPL 2.1       |