Skip to content

Commit 9497bb1

Browse files
authored
Merge branch '202205' into 202205
2 parents 462c618 + 2fc6aa9 commit 9497bb1

14 files changed

Lines changed: 449 additions & 14 deletions

File tree

files/scripts/startup_tsa_tsb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ def get_tsa_config(asic_ns):
4848
def get_tsa_status(num_asics):
4949
if num_asics > 1:
5050
counter = 0
51-
for asic_id in range(int(asic_num)):
51+
for asic_id in range(int(num_asics)):
5252
asic_ns = 'asic{}'.format(asic_id)
5353
sub_role = get_sub_role(asic_ns)
5454
if sub_role == 'FrontEnd':
5555
tsa_enabled = get_tsa_config(asic_ns)
5656
if tsa_enabled == 'false':
5757
counter += 1
58-
if counter == int(asic_num):
58+
if counter == int(num_asics):
5959
return True;
6060
else:
6161
tsa_enabled = get_tsa_config("")

platform/broadcom/platform-modules-nokia.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $(NOKIA_IXR7250_PLATFORM_MODULE)_PLATFORM = x86_64-nokia_ixr7250e_sup-r0
1212
$(NOKIA_IXR7250_PLATFORM_MODULE)_PLATFORM += x86_64-nokia_ixr7250e_36x400g-r0
1313
SONIC_DPKG_DEBS += $(NOKIA_IXR7250_PLATFORM_MODULE)
1414

15-
NDK_VERSION = 22.9.25
15+
NDK_VERSION = 22.9.26
1616
NOKIA_NDK_DEBIAN = ndk_$(NDK_VERSION)_amd64.deb
1717
$(NOKIA_NDK_DEBIAN)_URL = "https://github.com/Nokia-ION/ndk-releases/releases/download/v$(NDK_VERSION)/$(NOKIA_NDK_DEBIAN)"
1818
SONIC_ONLINE_DEBS += $(NOKIA_NDK_DEBIAN)

src/sonic-config-engine/portconfig.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,7 @@ def db_connect_configdb(namespace=None):
7272
"""
7373
Connect to configdb
7474
"""
75-
try:
76-
if namespace is not None:
77-
swsscommon.SonicDBConfig.load_sonic_global_db_config(namespace=namespace)
78-
config_db = swsscommon.ConfigDBConnector(use_unix_socket_path=True, namespace=namespace)
79-
except Exception as e:
80-
return None
75+
config_db = swsscommon.ConfigDBConnector(use_unix_socket_path=True, namespace=namespace)
8176
if config_db is None:
8277
return None
8378
try:

src/sonic-config-engine/sonic-cfggen

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ from config_samples import generate_sample_config, get_available_config
3131
from functools import partial
3232
from minigraph import minigraph_encoder, parse_xml, parse_device_desc_xml, parse_asic_sub_role, parse_asic_switch_type
3333
from portconfig import get_port_config, get_breakout_mode
34-
from sonic_py_common.multi_asic import get_asic_id_from_name, get_asic_device_id
34+
from sonic_py_common.multi_asic import get_asic_id_from_name, get_asic_device_id, is_multi_asic
3535
from sonic_py_common import device_info
3636
from swsscommon.swsscommon import ConfigDBConnector, SonicDBConfig, ConfigDBPipeConnector
3737

@@ -137,6 +137,14 @@ def ip_network(value):
137137
return "Invalid ip address %s" % value
138138
return r_v.network
139139

140+
def load_namespace_config():
141+
if is_multi_asic():
142+
if not SonicDBConfig.isGlobalInit():
143+
SonicDBConfig.initializeGlobalConfig()
144+
else:
145+
if not SonicDBConfig.isInit():
146+
SonicDBConfig.initialize()
147+
140148
class FormatConverter:
141149
"""Convert config DB based schema to legacy minigraph based schema for backward capability.
142150
We will move to DB schema and remove this class when the config templates are modified.
@@ -301,6 +309,7 @@ def main():
301309
deep_update(data, hardware_data)
302310
if args.port_config is None:
303311
args.port_config = device_info.get_path_to_port_config_file(hwsku)
312+
load_namespace_config()
304313
(ports, _, _) = get_port_config(hwsku, platform, args.port_config, asic_id)
305314
if ports is None:
306315
print('Failed to get port config', file=sys.stderr)
@@ -326,6 +335,7 @@ def main():
326335

327336
if args.minigraph is not None:
328337
minigraph = args.minigraph
338+
load_namespace_config()
329339
if platform:
330340
if args.port_config is not None:
331341
deep_update(data, parse_xml(minigraph, platform, args.port_config, asic_name=asic_name, hwsku_config_file=args.hwsku_config))
@@ -353,7 +363,7 @@ def main():
353363
if args.namespace is None:
354364
configdb = ConfigDBPipeConnector(use_unix_socket_path=use_unix_sock, **db_kwargs)
355365
else:
356-
SonicDBConfig.load_sonic_global_db_config(namespace=args.namespace)
366+
load_namespace_config()
357367
configdb = ConfigDBPipeConnector(use_unix_socket_path=use_unix_sock, namespace=args.namespace, **db_kwargs)
358368

359369
configdb.connect()
@@ -425,7 +435,7 @@ def main():
425435
if args.namespace is None:
426436
configdb = ConfigDBPipeConnector(use_unix_socket_path=True, **db_kwargs)
427437
else:
428-
SonicDBConfig.load_sonic_global_db_config(namespace=args.namespace)
438+
load_namespace_config()
429439
configdb = ConfigDBPipeConnector(use_unix_socket_path=True, namespace=args.namespace, **db_kwargs)
430440

431441
configdb.connect(False)

src/sonic-yang-models/doc/Configuration.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Table of Contents
2020
* [Cable length](#cable-length)
2121
* [Chassis module](#chassis-module)
2222
* [COPP_TABLE](#copp_table)
23+
* [Console](#console)
2324
* [CRM](#crm)
2425
* [Data Plane L3 Interfaces](#data-plane-l3-interfaces)
2526
* [DEFAULT_LOSSLESS_BUFFER_PARAMETER](#DEFAULT_LOSSLESS_BUFFER_PARAMETER)
@@ -51,7 +52,8 @@ Table of Contents
5152
* [Scheduler](#scheduler)
5253
* [Port QoS Map](#port-qos-map)
5354
* [Queue](#queue)
54-
* [Sflow](#sflow)
55+
* [Sflow](#sflow)
56+
* [Restapi](#restapi)
5557
* [Tacplus Server](#tacplus-server)
5658
* [TC to Priority group map](#tc-to-priority-group-map)
5759
* [TC to Queue map](#tc-to-queue-map)
@@ -714,6 +716,29 @@ It currently allows user to administratively bring down a line-card or fabric-ca
714716
}
715717
```
716718

719+
### Console
720+
721+
```
722+
{
723+
"CONSOLE_PORT": {
724+
"1": {
725+
"baud_rate": "115200",
726+
"flow_control": "0",
727+
"remote_device": "host-1"
728+
},
729+
"2": {
730+
"baud_rate": "9600",
731+
"flow_control": "1"
732+
}
733+
},
734+
"CONSOLE_SWITCH": {
735+
"console_mgmt": {
736+
"enabled": "yes"
737+
}
738+
}
739+
}
740+
```
741+
717742
### CRM
718743

719744
```
@@ -1509,6 +1534,25 @@ name as object key and member list as attribute.
15091534
}
15101535
```
15111536

1537+
### Restapi
1538+
```
1539+
{
1540+
"RESTAPI": {
1541+
"certs": {
1542+
"ca_crt": "/etc/sonic/credentials/ame_root.pem",
1543+
"server_key": "/etc/sonic/credentials/restapiserver.key",
1544+
"server_crt": "/etc/sonic/credentials/restapiserver.crt",
1545+
"client_crt_cname": "client.sonic.net"
1546+
},
1547+
"config": {
1548+
"client_auth": "true",
1549+
"log_level": "trace",
1550+
"allow_insecure": "false"
1551+
}
1552+
}
1553+
1554+
```
1555+
15121556
### Sflow
15131557

15141558
The below are the tables and their schema for SFLOW feature

src/sonic-yang-models/setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def run(self):
9999
'./yang-models/sonic-cable-length.yang',
100100
'./yang-models/sonic-chassis-module.yang',
101101
'./yang-models/sonic-copp.yang',
102+
'./yang-models/sonic-console.yang',
102103
'./yang-models/sonic-crm.yang',
103104
'./yang-models/sonic-default-lossless-buffer-parameter.yang',
104105
'./yang-models/sonic-device_metadata.yang',
@@ -130,6 +131,7 @@ def run(self):
130131
'./yang-models/sonic-policer.yang',
131132
'./yang-models/sonic-portchannel.yang',
132133
'./yang-models/sonic-pfcwd.yang',
134+
'./yang-models/sonic-restapi.yang',
133135
'./yang-models/sonic-route-common.yang',
134136
'./yang-models/sonic-route-map.yang',
135137
'./yang-models/sonic-routing-policy-sets.yang',

src/sonic-yang-models/tests/files/sample_config_db.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,19 @@
11221122
"lanes": "1"
11231123
}
11241124
},
1125+
"RESTAPI": {
1126+
"certs": {
1127+
"ca_crt": "/etc/sonic/credentials/ame_root.pem",
1128+
"server_key": "/etc/sonic/credentials/restapiserver.key",
1129+
"server_crt": "/etc/sonic/credentials/restapiserver.crt",
1130+
"client_crt_cname": "client.sonic.net"
1131+
},
1132+
"config": {
1133+
"client_auth": "true",
1134+
"log_level": "trace",
1135+
"allow_insecure": "false"
1136+
}
1137+
},
11251138
"FLEX_COUNTER_TABLE": {
11261139
"PFCWD": {
11271140
"FLEX_COUNTER_STATUS": "enable"
@@ -2036,6 +2049,22 @@
20362049
"default_dynamic_th": "0",
20372050
"over_subscribe_ratio": "0"
20382051
}
2052+
},
2053+
"CONSOLE_PORT": {
2054+
"1": {
2055+
"baud_rate": "115200",
2056+
"flow_control": "0",
2057+
"remote_device": "host-1"
2058+
},
2059+
"2": {
2060+
"baud_rate": "9600",
2061+
"flow_control": "1"
2062+
}
2063+
},
2064+
"CONSOLE_SWITCH": {
2065+
"console_mgmt": {
2066+
"enabled": "yes"
2067+
}
20392068
}
20402069
},
20412070
"SAMPLE_CONFIG_DB_UNKNOWN": {
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"CONSOLE_DISABLED": {
3+
"desc": "Verifying CONSOLE_SWITCH configuration."
4+
},
5+
"CONSOLE_DEFAULT_CONSOLE_MGMT": {
6+
"desc": "CONSOLE_SWITCH default value for console_mgmt enabled field.",
7+
"eStrKey": "Verify",
8+
"verify": {
9+
"xpath": "/sonic-console:sonic-console/CONSOLE_SWITCH/console_mgmt/enabled",
10+
"key": "sonic-console:enabled",
11+
"value": "no"
12+
}
13+
},
14+
"CONSOLE_DISABLED_INCORRECT_PATTERN": {
15+
"desc": "CONSOLE_SWITCH configuration pattern failure.",
16+
"eStrKey": "Pattern"
17+
},
18+
"CONSOLE_PORT_DEFAULT_FLOW_CONTROL": {
19+
"desc": "CONSOLE_PORT default value for flow_control field.",
20+
"eStrKey": "Verify",
21+
"verify": {
22+
"xpath": "/sonic-console:sonic-console/CONSOLE_PORT/CONSOLE_PORT_LIST[name='1']/flow_control",
23+
"key": "sonic-console:flow_control",
24+
"value": "0"
25+
}
26+
},
27+
"CONSOLE_PORT_INVALID_NAME": {
28+
"desc": "CONSOLE_PORT invalid name failure.",
29+
"eStrKey": "InvalidValue",
30+
"eStr": ["name"]
31+
},
32+
"CONSOLE_PORT_INVALID_BAUD": {
33+
"desc": "CONSOLE_PORT invalid baud failure.",
34+
"eStrKey": "InvalidValue",
35+
"eStr": ["baud"]
36+
},
37+
"CONSOLE_PORT_VALID": {
38+
"desc": "Verifying CONSOLE_PORT configuration no failure."
39+
}
40+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"RESTAPI_TABLE_WITH_INCORRECT_CERT": {
3+
"desc": "RESTAPI TABLE_WITH_INCORRECT_CERT failure.",
4+
"eStr": ["Value", "does not satisfy the constraint"]
5+
},
6+
"RESTAPI_TABLE_WITH_INCORRECT_CLIENT": {
7+
"desc": "RESTAPI TABLE_WITH_INCORRECT_CLIENT failure.",
8+
"eStr": ["Value", "does not satisfy the constraint"]
9+
},
10+
"RESTAPI_TABLE_WITH_VALID_CONFIG": {
11+
"desc": "RESTAPI TABLE WITH VALID CONFIG."
12+
},
13+
"RESTAPI_TABLE_WITH_MULTIPLE_CERTS": {
14+
"desc": "RESTAPI TABLE WITH MULTIPLE CERTS."
15+
}
16+
}

0 commit comments

Comments
 (0)