From d54e432edc0eb3a0d62e7d82bfa0a5e12b6d038a Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 26 Jul 2017 21:44:12 +0000 Subject: [PATCH 1/5] Add first version of ConfigDB schema --- doc/configdb-schema.md | 66 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 doc/configdb-schema.md diff --git a/doc/configdb-schema.md b/doc/configdb-schema.md new file mode 100644 index 000000000..1fe37a52b --- /dev/null +++ b/doc/configdb-schema.md @@ -0,0 +1,66 @@ +Schema data is defined in ABNF [RFC5234](https://tools.ietf.org/html/rfc5234) syntax. + +### Definitions of common tokens + name = 1*DIGIT/1*ALPHA + ref_hash_key_reference = "[" hash_key "]" ;The token is a refernce to another valid DB key. + hash_key = name ; a valid key name (i.e. exists in DB) + +### DEVICE_METADATA table + +### BGP_NEIGHBOR table + + ; Stores BGP session information + bgp_neighbor_key = IPPrefix ; IP address of BGP neighbor + asn = 1*5DIGIT ; remote ASN + admin_status = "down" / "up" ; admin status + name = 1*64VCHAR ; neighbor host name + peer_addr = IPPrefix ; local address used to peer with neighbor + + ;QOS Mappings + map_dscp_to_tc = ref_hash_key_reference + map_tc_to_queue = ref_hash_key_reference + + Example: + 127.0.0.1:6379[4]> keys BGP_NEIGHBOR:* + 1) "BGP_NEIGHBOR:10.0.0.31" + 2) "BGP_NEIGHBOR:10.0.0.39" + 3) "BGP_NEIGHBOR:10.0.0.11" + 4) "BGP_NEIGHBOR:10.0.0.7" + 5) "BGP_NEIGHBOR:10.0.0.15" + 6) "BGP_NEIGHBOR:10.0.0.45" + 7) "BGP_NEIGHBOR:10.0.0.35" + 8) "BGP_NEIGHBOR:10.0.0.51" + 9) "BGP_NEIGHBOR:10.0.0.1" + 10) "BGP_NEIGHBOR:10.0.0.43" + 11) "BGP_NEIGHBOR:10.0.0.3" + 12) "BGP_NEIGHBOR:10.0.0.21" + 13) "BGP_NEIGHBOR:10.0.0.55" + 14) "BGP_NEIGHBOR:10.0.0.17" + 15) "BGP_NEIGHBOR:10.0.0.19" + 16) "BGP_NEIGHBOR:10.0.0.25" + 17) "BGP_NEIGHBOR:10.0.0.63" + 18) "BGP_NEIGHBOR:10.0.0.41" + 19) "BGP_NEIGHBOR:10.0.0.29" + 20) "BGP_NEIGHBOR:10.0.0.33" + 21) "BGP_NEIGHBOR:10.0.0.5" + 22) "BGP_NEIGHBOR:10.0.0.23" + 23) "BGP_NEIGHBOR:10.0.0.13" + 24) "BGP_NEIGHBOR:10.0.0.27" + 25) "BGP_NEIGHBOR:10.0.0.57" + 26) "BGP_NEIGHBOR:10.0.0.47" + 27) "BGP_NEIGHBOR:10.0.0.37" + 28) "BGP_NEIGHBOR:10.0.0.53" + 29) "BGP_NEIGHBOR:10.0.0.49" + 30) "BGP_NEIGHBOR:10.0.0.9" + 31) "BGP_NEIGHBOR:10.0.0.61" + 32) "BGP_NEIGHBOR:10.0.0.59" + 127.0.0.1:6379[4]> hgetall BGP_NEIGHBOR:10.0.0.13 + 1) "admin_status" + 2) "up" + 3) "peer_addr" + 4) "10.0.0.12" + 5) "asn" + 6) "65200" + 7) "name" + 8) "ARISTA07T2" + From 90cdf96dba20132a8df15ddb05f8bf6805aa1fae Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 8 Aug 2017 12:15:28 -0700 Subject: [PATCH 2/5] Add schema draft for multiple tables --- doc/configdb-schema.md | 131 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 127 insertions(+), 4 deletions(-) diff --git a/doc/configdb-schema.md b/doc/configdb-schema.md index 1fe37a52b..88d48c15f 100644 --- a/doc/configdb-schema.md +++ b/doc/configdb-schema.md @@ -4,22 +4,54 @@ Schema data is defined in ABNF [RFC5234](https://tools.ietf.org/html/rfc5234) sy name = 1*DIGIT/1*ALPHA ref_hash_key_reference = "[" hash_key "]" ;The token is a refernce to another valid DB key. hash_key = name ; a valid key name (i.e. exists in DB) + LIST(type) = *(type,)type ; a list of values in specific type, seperated by ',' + IPprefix = IPv4prefix / IPv6prefix ; an instance of this key/value pair will be repeated for each prefix + IPv6prefix = 6( h16 ":" ) ls32 + / "::" 5( h16 ":" ) ls32 + / [ h16 ] "::" 4( h16 ":" ) ls32 + / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 + / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 + / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 + / [ *4( h16 ":" ) h16 ] "::" ls32 + / [ *5( h16 ":" ) h16 ] "::" h16 + / [ *6( h16 ":" ) h16 ] "::" + h16 = 1*4HEXDIG + ls32 = ( h16 ":" h16 ) / IPv4address + IPv4prefix = dec-octet "." dec-octet "." dec-octet "." dec-octet "/" %d1-32 ### DEVICE_METADATA table + ; Key + device_metadata_key = 'localhost' ; there shall be only one instance of DEVICE_METADATA table, and the key shall always be 'localhost' + ; Attributes + deployment_id = 1*2DIGIT ; an integer between 0 and 99 to indicate the deployment enviroment of device + bgp_asn = 1*5DIGIT ; local as number. it is based on the fact that currently only single instance of BGP is supported on SONiC. If multiple instances are to be supported this field will needs to be extended into another table. + hostname = 1*64VCHAR + hwsku = 1*64VCHAR +    type               = 1*64VCHAR     ; deployment type of the switch. Apps might enable/disable some features based on value of this field. +     + Example: + 127.0.0.1:6379[4]> hgetall DEVICE_METADATA:localhost + 1) "bgp_asn" + 2) "65000" + 3) "hwsku" + 4) "MSN2700" + 5) "hostname" + 6) "switch1" + 7) "type" + 8) "ToRRouter" + ### BGP_NEIGHBOR table ; Stores BGP session information + ; Key bgp_neighbor_key = IPPrefix ; IP address of BGP neighbor + ; Attributes asn = 1*5DIGIT ; remote ASN admin_status = "down" / "up" ; admin status name = 1*64VCHAR ; neighbor host name peer_addr = IPPrefix ; local address used to peer with neighbor - ;QOS Mappings - map_dscp_to_tc = ref_hash_key_reference - map_tc_to_queue = ref_hash_key_reference - Example: 127.0.0.1:6379[4]> keys BGP_NEIGHBOR:* 1) "BGP_NEIGHBOR:10.0.0.31" @@ -64,3 +96,94 @@ Schema data is defined in ABNF [RFC5234](https://tools.ietf.org/html/rfc5234) sy 7) "name" 8) "ARISTA07T2" +### BGP_PEER_RANGE table + + ; Key + bgp_peer_range_key = 1*64VCHAR + ; Attributes + name = 1*64VCHAR + ip_range = LIST(IPPrefix) + + +### MGMT_INTERFACE table + + ; Key + mgmt_interface_key = IPPrefix + ; Attributes + name = 1*64VCHAR + gwaddr = IPAddress + forced_mgmt_routes = LIST(IPPrefix) + + +### LOOPBACK_INTERFACE table + + ; Key + loopback_interface_key = IPPrefix + ; Attributes + name = 1*64VCHAR + + +### PORT table + + ; Key + port_key = 1*64VCHAR + ; Attributes + alias = 1*64VCHAR + MTU = 1*5DIGIT + front_panel_index = 1*3DIGIT + +### INTERFACE table + + ; Key + interface_key = IPPrefix + ; Attributes + attachto = 1*64VCHAR + +### PORTCHANNEL table + + ; Key + portchannel_key = 1*64VCHAR + ; Attributes + members = LIST(1*64VCHAR) + +### PORTCHANNEL_INTERFACE table + + ; Key + portchannel_intfs_key = IPPrefix + ; Attributes + attachto = 1*64VCHAR + +### VLAN table + + ; Key + vlan_key = 1*64VCHAR + ; Attributes + id = 1*5DIGIT + members = LIST(1*64VCHAR) + +### VLAN_INTERFACE table + + ; Key + vlan_interface_key = IPPrefix + ; Attributes + attachto = 1*64VCHAR + +### DEVICE_NEIGHBOR table + + ; Key + device_neighbor_key = 1*64VCHAR ; neighbor host name + ; Attributes + port = 1*64VCHAR + local_port = 1*64VCHAR + type = 1*64VCHAR + hwsku = 1*64VCHAR + mgmt_addr = IPPrefix + lo_addr = IPPrefix + +### MIRROR_SESSION table + + ; Key + mirror_session_key = 1*64VCHAR + ; Attributes + erspan_dst = IPPrefix + From 93efddda7d8d6f97d9a1537cf619bfb266a2f9df Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 8 Aug 2017 12:17:15 -0700 Subject: [PATCH 3/5] Fix format issue --- doc/configdb-schema.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/configdb-schema.md b/doc/configdb-schema.md index 88d48c15f..84af4bed0 100644 --- a/doc/configdb-schema.md +++ b/doc/configdb-schema.md @@ -27,9 +27,9 @@ Schema data is defined in ABNF [RFC5234](https://tools.ietf.org/html/rfc5234) sy deployment_id = 1*2DIGIT ; an integer between 0 and 99 to indicate the deployment enviroment of device bgp_asn = 1*5DIGIT ; local as number. it is based on the fact that currently only single instance of BGP is supported on SONiC. If multiple instances are to be supported this field will needs to be extended into another table. hostname = 1*64VCHAR - hwsku = 1*64VCHAR -    type               = 1*64VCHAR     ; deployment type of the switch. Apps might enable/disable some features based on value of this field. -     + hwsku = 1*64VCHAR + type               = 1*64VCHAR     ; deployment type of the switch. Apps might enable/disable some features based on value of this field.     + Example: 127.0.0.1:6379[4]> hgetall DEVICE_METADATA:localhost 1) "bgp_asn" From 7c6963a15378d5b59c7653c9e66c037b593b924a Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 21 Aug 2017 15:14:38 -0700 Subject: [PATCH 4/5] Resolve comments --- doc/configdb-schema.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/configdb-schema.md b/doc/configdb-schema.md index 84af4bed0..4845a6edd 100644 --- a/doc/configdb-schema.md +++ b/doc/configdb-schema.md @@ -2,8 +2,8 @@ Schema data is defined in ABNF [RFC5234](https://tools.ietf.org/html/rfc5234) sy ### Definitions of common tokens name = 1*DIGIT/1*ALPHA - ref_hash_key_reference = "[" hash_key "]" ;The token is a refernce to another valid DB key. - hash_key = name ; a valid key name (i.e. exists in DB) + ref_hash_key_reference = "[" hash_key "]" ; The token is a refernce to another valid DB key. + hash_key = name ; a valid key name (i.e. exists in DB) LIST(type) = *(type,)type ; a list of values in specific type, seperated by ',' IPprefix = IPv4prefix / IPv6prefix ; an instance of this key/value pair will be repeated for each prefix IPv6prefix = 6( h16 ":" ) ls32 From a9e2a9b99e0f619e820ca9bb45635f0fa3bba313 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 12 Sep 2017 18:07:34 -0700 Subject: [PATCH 5/5] Update schema according to https://github.com/Azure/sonic-buildimage/pull/942 --- doc/configdb-schema.md | 75 +++++++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 19 deletions(-) diff --git a/doc/configdb-schema.md b/doc/configdb-schema.md index 4845a6edd..c82204cc3 100644 --- a/doc/configdb-schema.md +++ b/doc/configdb-schema.md @@ -45,7 +45,7 @@ Schema data is defined in ABNF [RFC5234](https://tools.ietf.org/html/rfc5234) sy ; Stores BGP session information ; Key - bgp_neighbor_key = IPPrefix ; IP address of BGP neighbor + bgp_neighbor_key = IPAddress ; IP address of BGP neighbor ; Attributes asn = 1*5DIGIT ; remote ASN admin_status = "down" / "up" ; admin status @@ -108,55 +108,59 @@ Schema data is defined in ABNF [RFC5234](https://tools.ietf.org/html/rfc5234) sy ### MGMT_INTERFACE table ; Key - mgmt_interface_key = IPPrefix + port_name = 1*64VCHAR ; name of mgmt port that the ip interface attach to + ip_prefix = IPPrefix ; Attributes - name = 1*64VCHAR gwaddr = IPAddress - forced_mgmt_routes = LIST(IPPrefix) + forced_mgmt_routes = LIST(IPPrefix) ; the prefixes to which route will be force to be going through mgmt port ### LOOPBACK_INTERFACE table ; Key - loopback_interface_key = IPPrefix + port_name = 1*64VCHAR + ip_prefix = IPPrefix ; Attributes - name = 1*64VCHAR + ; No attributes ### PORT table ; Key - port_key = 1*64VCHAR + name = 1*64VCHAR ; Attributes alias = 1*64VCHAR MTU = 1*5DIGIT - front_panel_index = 1*3DIGIT + front_panel_index = 1*3DIGIT + speed = 1*5DIGIT ### INTERFACE table ; Key - interface_key = IPPrefix + port_name = 1*64VCHAR + ip_prefix = IPPrefix ; Attributes - attachto = 1*64VCHAR + ; No attributes ### PORTCHANNEL table ; Key - portchannel_key = 1*64VCHAR + name = 1*64VCHAR ; Attributes - members = LIST(1*64VCHAR) + members = LIST(1*64VCHAR) ### PORTCHANNEL_INTERFACE table ; Key - portchannel_intfs_key = IPPrefix + portchannel_name = 1*64VCHAR + ip_prefix = IPPrefix ; Attributes - attachto = 1*64VCHAR + ; No attributes ### VLAN table ; Key - vlan_key = 1*64VCHAR + name = 1*64VCHAR ; Attributes id = 1*5DIGIT members = LIST(1*64VCHAR) @@ -164,14 +168,15 @@ Schema data is defined in ABNF [RFC5234](https://tools.ietf.org/html/rfc5234) sy ### VLAN_INTERFACE table ; Key - vlan_interface_key = IPPrefix + vlan_name = 1*64VCHAR + ip_prefix = IPPrefix ; Attributes - attachto = 1*64VCHAR + ; No attributes ### DEVICE_NEIGHBOR table ; Key - device_neighbor_key = 1*64VCHAR ; neighbor host name + neighbor_name = 1*64VCHAR ; neighbor host name ; Attributes port = 1*64VCHAR local_port = 1*64VCHAR @@ -185,5 +190,37 @@ Schema data is defined in ABNF [RFC5234](https://tools.ietf.org/html/rfc5234) sy ; Key mirror_session_key = 1*64VCHAR ; Attributes - erspan_dst = IPPrefix + src_ip = IPPrefix + dst_ip = IPPrefix +### ACL_TABLE table + + ; Key + acl_table_key = 1*64VCHAR + ; Attributes + policy_desc = 1*255VCHAR ; name of the ACL policy table description + type = "mirror"/"l3" ; type of acl table, every type of + ; table defines the match/action a + ; specific set of match and actions. + ports = [0-max_ports]*port_name ; the ports to which this ACL + ; table is applied, can be emtry + ; value annotations + +### NTP_SERVER table + + ; Key + server_url = 1*128VCHAR + ; No attributes + +### SYSLOG_SERVER table + + ; Key + server_url = 1*128VCHAR + ; No attributes + +### DHCP_SERVER table + + ; Key + server_url = 1*128VCHAR + ; No attributes +