G

G = <networkx.classes.digraph.DiGraph object>

有向拓樸,負責儲存整體網路狀態與拓樸

G的儲存結構

交換機($datapath.id,None)的資訊:
GLOBAL_VALUE.G.nodes[($datapath.id,None)]
                                        |["datapath"]=<Datapath object>
                                        |["port"]={$port_id:{
                                                            "OFPMP_PORT_DESC":{"port_no": 1, "length": 72, "hw_addr": "be:f3:b6:8a:f8:1e", "config": 0,"state": 4, "properties": [{"type": 0, "length": 32, "curr": 2112,"advertised": 0, "supported": 0, "peer": 0, "curr_speed": 10000000,"max_speed": 0}], "update_time": 1552314248.2066813},
                                                            "OFPMP_PORT_STATS":{'length': 304, 'port_no': 2, 'duration_sec': 17, 'duration_nsec': 235000000, 'rx_packets': 11, 'tx_packets': 10, 'rx_bytes': 698, 'tx_bytes': 684, 'rx_dropped': 0, 'tx_dropped': 0, 'rx_errors': 0, 'tx_errors': 0, 'properties': [{'type': 0, 'length': 40, 'rx_frame_err': 0, 'rx_over_err': 0, 'rx_crc_err': 0, 'collisions': 0}, {'type': 65535, 'length': 184, 'experimenter': 43521, 'exp_type': 1, 'data': [0, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295]}], 'update_time': 1553333684.6574402, 'rx_bytes_delta': 14, 'tx_bytes_delta': 14},
                                                            #for ARP table
                                                            "host":{[ip address]:[mac adress]}
                                                            }
                                                    }
                                        #sec 'active working duration of all port '
                                        |["all_port_duration_s"]=<class 'int'>
                                        #temp when del the port, a new port restart,    #OFPMP_PORT_STATS's duration_sec will be zero
                                        |["all_port_duration_s_temp"]=<class 'int'>
                                        |["FLOW_TABLE"][$table_id<class 'int'>][$priority<class 'int'>][$match<class 'str'>]=<class 'ryu.ofproto.ofproto_v1_5_parser.OFPFlowMod'>
                                        |["now_max_group_id"]=0
                                        |["now_max_xid"]=0
                                        |["GROUP_TABLE"][$group_id<class 'int'>]=<class 'ryu.ofproto.ofproto_v1_5_parser.OFPGroupMod'>
從交換機`$datapath.id1`的`$datapath.port1` port 到 交換機`$datapath.id2`的`$datapath.port2` port的鏈路資訊:
GLOBAL_VALUE.G[($datapath.id1,$datapath.port1)][($datapath.id2,$datapath.port2)]|["detect"]|["latency_ms"]:0~max
                                                                                    |["jitter_ms"]:0~max
                                                                                    |["bandwidth_bytes_per_s"]:0~max_bandwidth 重要!!這個代表鏈路可用的頻寬
                                                                                    |["loss_percent"]:0~1%
                                                                        |["tmp"][$seq]={"start":timestamp,"end":timestamp}