Skip to content

Commit 6293c3d

Browse files
Darren LoherShuotian Cheng
Darren Loher
authored and
Shuotian Cheng
committed
doc: Adding documentations
1 parent 0008c83 commit 6293c3d

File tree

5 files changed

+178
-21
lines changed

5 files changed

+178
-21
lines changed

LICENSE

+10-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
1-
The MIT License (MIT)
2-
Copyright (c) 2016 Microsoft Inc
1+
Copyright 2016 Microsoft, Inc.
32

4-
Permission is hereby granted, free of charge, to any person obtaining a copy
5-
of this software and associated documentation files (the "Software"), to
6-
deal in the Software without restriction, including without limitation the
7-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8-
sell copies of the Software, and to permit persons to whom the Software is
9-
furnished to do so, subject to the following conditions:
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
106

11-
The above copyright notice and this permission notice shall be included in
12-
all copies or substantial portions of the Software.
7+
http://www.apache.org/licenses/LICENSE-2.0
138

14-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17-
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20-
THE SOFTWARE.
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

MAINTAINERS

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file describes the maintainers for SwSS
2+
# See the SONiC project governance document for more information
3+
4+
Name = "Shuotian Cheng"
5+
Email = "shuche@microsoft.com"
6+
Github = stcheng
7+
Mailinglist = sonicproject@googlegroups.com

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
[![Build Status](https://sonic-jenkins.westus.cloudapp.azure.com/buildStatus/icon?job=swss-build)](https://sonic-jenkins.westus.cloudapp.azure.com/job/swss-build)
2-
# Switch State Service - swss
1+
[![Build Status](https://sonic-jenkins.westus.cloudapp.azure.com/job/sonic-swss-build/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/sonic-swss-build/)
32

4-
### This software repository must be treated as private and is only shared under NDA terms with Microsoft until publicly released.
3+
# Switch State Service - swss
54

65
# Description
76
The Switch State Service (SwSS) is a collection of software that provides a database interface for communication with and state representation of network applications and network switch hardware.
87

98
# Contribution guide
109

11-
All contributors must sign a contribution license agreement before contributions can be accepted. Contact kasubra@microsoft.com or daloher@microsoft.com. Later this will be automated.
10+
See the [contributors guide](https://github.com/Azure/SONiC/blob/gh-pages/contributing.md) for information about how to contribute.
1211

1312
### GitHub Workflow
1413

doc/architecture.docx

-350 KB
Binary file not shown.

doc/swss-schema.md

+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
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

Comments
 (0)