|
| 1 | +Schema data is defined in ABNF [RFC5234](https://tools.ietf.org/html/rfc5234) syntax. |
| 2 | + |
| 3 | +###PORT_TABLE |
| 4 | +Stores information for physical switch ports managed by the switch chip. device_names are defined in [port_config.ini](https://github.com/stcheng/swss/blob/mock/portsyncd/port_config.ini). Ports to the CPU (ie: management port) and logical ports (loopback) are not declared in the PORT_TABLE. See INTF_TABLE. |
| 5 | + |
| 6 | + ;Defines layer 2 ports |
| 7 | + ;In SONiC, Data is loaded from configuration file by portsyncd |
| 8 | + ;Status: Mandatory |
| 9 | + port_table_key = PORT_TABLE:ifname ; ifname must be unique across PORT,INTF,VLAN,LAG TABLES |
| 10 | + device_name = 1*64VCHAR ; must be unique across PORT,INTF,VLAN,LAG TABLES and must map to PORT_TABLE.name |
| 11 | + admin_status = BIT ; is the port enabled (1) or disabled (0) |
| 12 | + oper_status = BIT ; physical status up (1) or down (0) of the link attached to this port |
| 13 | + lanes = list of lanes ; (need format spec???) |
| 14 | + ifname = 1*64VCHAR ; name of the port, must be unique |
| 15 | + mac = 12HEXDIG ; |
| 16 | + |
| 17 | +###INTF_TABLE |
| 18 | +intfsyncd manages this table. In SONiC, CPU (management) and logical ports (vlan, loopback, LAG) are declared in /etc/network/interface and loaded into the INTF_TABLE. |
| 19 | + |
| 20 | +IP prefixes are formatted according to [RFC5954](https://tools.ietf.org/html/rfc5954) with a prefix length appended to the end |
| 21 | + |
| 22 | + ;defines logical network interfaces, an attachment to a PORT and list of 0 or more |
| 23 | + ;ip prefixes |
| 24 | + ; |
| 25 | + ;Status: stable |
| 26 | + key = INTF_TABLE:ifname:IPprefix ; an instance of this key will be repeated for each prefix |
| 27 | + IPprefix = IPv4prefix / IPv6prefix ; an instance of this key/value pair will be repeated for each prefix |
| 28 | + scope = "global" / "local" ; local is an interface visible on this localhost only |
| 29 | + if_mtu = 1*4DIGIT ; MTU for the interface |
| 30 | + family = "IPv4" / "IPv6" ; address family |
| 31 | + |
| 32 | + IPv6prefix = 6( h16 ":" ) ls32 |
| 33 | + / "::" 5( h16 ":" ) ls32 |
| 34 | + / [ h16 ] "::" 4( h16 ":" ) ls32 |
| 35 | + / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 |
| 36 | + / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 |
| 37 | + / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 |
| 38 | + / [ *4( h16 ":" ) h16 ] "::" ls32 |
| 39 | + / [ *5( h16 ":" ) h16 ] "::" h16 |
| 40 | + / [ *6( h16 ":" ) h16 ] "::" |
| 41 | + |
| 42 | + h16 = 1*4HEXDIG |
| 43 | + ls32 = ( h16 ":" h16 ) / IPv4address |
| 44 | + |
| 45 | + IPv4prefix = dec-octet "." dec-octet "." dec-octet "." dec-octet “/” %d1-32 |
| 46 | + |
| 47 | + dec-octet = DIGIT ; 0-9 |
| 48 | + / %x31-39 DIGIT ; 10-99 |
| 49 | + / "1" 2DIGIT ; 100-199 |
| 50 | + / "2" %x30-34 DIGIT ; 200-249 |
| 51 | + / "25" %x30-35 ; 250-255 |
| 52 | + |
| 53 | +For example (reorder output) |
| 54 | + |
| 55 | + 127.0.0.1:6379> keys * |
| 56 | + 1) "INTF_TABLE:lo:127.0.0.1/8" |
| 57 | + 4) "INTF_TABLE:lo:::1" |
| 58 | + 5) "INTF_TABLE:eth0:fe80::5054:ff:fece:6275/64" |
| 59 | + 6) "INTF_TABLE:eth0:10.212.157.5/16" |
| 60 | + 7) "INTF_TABLE:eth0.10:99.99.98.0/24" |
| 61 | + 2) "INTF_TABLE:eth0.10:99.99.99.0/24" |
| 62 | + |
| 63 | + 127.0.0.1:6379> HGETALL "INTF_TABLE:eth0.10:99.99.99.0/24" |
| 64 | + 1) "scope" |
| 65 | + 2) "global" |
| 66 | + 3) "if_up" |
| 67 | + 4) "1" |
| 68 | + 5) "if_lower_up" |
| 69 | + 6) "1" |
| 70 | + 7) "if_mtu" |
| 71 | + 8) "1500" |
| 72 | + 127.0.0.1:6379> HGETALL "INTF_TABLE:eth0:fe80::5054:ff:fece:6275/64" |
| 73 | + 1) "scope" |
| 74 | + 2) "local" |
| 75 | + 3) "if_up" |
| 76 | + 4) "1" |
| 77 | + 5) "if_lower_up" |
| 78 | + 6) "1" |
| 79 | + 7) "if_mtu" |
| 80 | + 8) "65536" |
| 81 | + |
| 82 | + |
| 83 | +###VLAN_TABLE |
| 84 | + ;Defines VLANs and the interfaces which are members of the vlan |
| 85 | + ;Status: work in progress |
| 86 | + key = DEVICE_NAME ; must be unique across PORT,INTF,VLAN,LAG TABLES |
| 87 | + vland_id = DIGIT 0-4095 |
| 88 | + admin_status = BIT ; administrative status for vlan up or down |
| 89 | + attach_to = PORT_TABLE.key |
| 90 | + |
| 91 | +###LAG_TABLE |
| 92 | + ;a logical, link aggregation group interface (802.3ad) made of one or more ports |
| 93 | + ;In SONiC, data is loaded by teamsyncd |
| 94 | + ;Status: work in progress |
| 95 | + key = LAG_TABLE:lagname ; logical 802.3ad LAG interface |
| 96 | + minimum_links = 1*2DIGIT ; to be implemented |
| 97 | + admin_status = "down" / "up" ; Admin status |
| 98 | + oper_status = "down" / "up" ; Oper status (physical + protocol state) |
| 99 | + if_mtu = 1*4DIGIT ; MTU for this object |
| 100 | + linkup |
| 101 | + speed |
| 102 | + |
| 103 | + key = LAG_TABLE:lagname:ifname ; physical port member of LAG, fk to PORT_TABLE:ifname |
| 104 | + oper_status = "down" / "up" ; Oper status (physical + 802.3ad state) |
| 105 | + speed = ; set by LAG application, must match PORT_TABLE.duplex |
| 106 | + duplex = ; set by LAG application, must match PORT_TABLE.duplex |
| 107 | + |
| 108 | +For example, in a libteam implemenation, teamsyncd listens to Linux `RTM_NEWLINK` and `RTM_DELLINK` messages and creates or delete entries at the `LAG_TABLE:<team0>` |
| 109 | + |
| 110 | + 127.0.0.1:6379> HGETALL "LAG_TABLE:team0" |
| 111 | + 1) "admin_status" |
| 112 | + 2) "down" |
| 113 | + 3) "oper_status" |
| 114 | + 4) "down" |
| 115 | + 5) "mtu" |
| 116 | + 6) "1500" |
| 117 | + |
| 118 | +In addition for each team device, the teamsyncd listens to team events |
| 119 | +and reflects the LAG ports into the redis under: `LAG_TABLE:<team0>:port` |
| 120 | + |
| 121 | + 127.0.0.1:6379> HGETALL "LAG_TABLE:team0:veth0" |
| 122 | + 1) "linkup" |
| 123 | + 2) "down" |
| 124 | + 3) "speed" |
| 125 | + 4) "0Mbit" |
| 126 | + 5) "duplex" |
| 127 | + 6) "half" |
| 128 | + |
| 129 | + |
| 130 | +###ROUTE_TABLE |
| 131 | + ;Stores a list of routes |
| 132 | + ;Status: Mandatory |
| 133 | + key = ROUTE_TABLE:prefix |
| 134 | + nexthop = *prefix, ;IP addresses separated “,” (empty indicates no gateway) |
| 135 | + intf = ifindex? PORT_TABLE.key ; zero or more separated by “,” (zero indicates no interface) |
| 136 | + blackhole = BIT ; Set to 1 if this route is a blackhole (or null0) |
| 137 | + |
| 138 | + |
| 139 | +###NEIGH_TABLE |
| 140 | + ; Stores the neighbors or next hop IP address and output port or |
| 141 | + ; interface for routes |
| 142 | + ; Note: neighbor_sync process will resolve mac addr for neighbors |
| 143 | + ; using libnl to get neighbor table |
| 144 | + ;Status: Mandatory |
| 145 | + key = prefix PORT_TABLE.name / VLAN_INTF_TABLE.name / LAG_INTF_TABLE.name = macaddress ; (may be empty) |
| 146 | + neigh = 12HEXDIG ; mac address of the neighbor |
| 147 | + family = "IPv4" / "IPv6" ; address family |
| 148 | + |
| 149 | + |
| 150 | +###Configuration files |
| 151 | +What configuration files should we have? Do apps, orch agent each need separate files? |
| 152 | + |
| 153 | +[port_config.ini](https://github.com/stcheng/swss/blob/mock/portsyncd/port_config.ini) - defines physical port information |
| 154 | + |
| 155 | +portsyncd reads from port_config.ini and updates PORT_TABLE in APP_DB |
| 156 | + |
| 157 | +All other apps (intfsyncd) read from PORT_TABLE in APP_DB |
| 158 | + |
0 commit comments