Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UT test_config_reload_untriggered_timer #81

Conversation

xincunli-sonic
Copy link

What I did

How I did it

How to verify it

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

lixiaoyuner and others added 30 commits December 1, 2022 15:34
* Change show kube command default value of insecure key to True

Signed-off-by: Yun Li <[email protected]>

* Add test cases

Signed-off-by: Yun Li <[email protected]>
- What I did
Since PG counters are created only if they are configured in the switch, it is not enough to relay only on the first entry in the DB when building the output table of watermarkstat script.
We need to go over all configured counters, check what is the max configured and build the table accordingly.

- How I did it
Iterate all configured PG buffers for all ports and find the max index.
Build the output table according to the max index.

- How to verify it
Run test "pgdropstat_test.py" including this PR and observe it passes.
…#2133)

The current implementation has two issues:

1. In case containers from "docker ps" output are ordered in a way that database is first in the list, the "systemctl stop database" followed by "docker kill database" will stop all other containers through systemd
and ruin this optimization
2. After "docker kill database" there are lots of errors from daemons like hostcfgd, system-healthd, caclmgrd, etc. Also it causes those daemons to hang when received SIGTERM making a delay on following "systemctl stop database".

In the new implementation, services are implicitly stopped by systemd in the order that is correct. If a certain container needs an optimization that will kill the container instead of stopping it the container may implement this optimization in its /usr/local/bin/*.sh script.

It is also more optimal since independent services might be stopped in parallel.

- What I did
Stop services using systemd

- How I did it
Stop services using systemd

- How to verify it
Run warm-reboot.

Signed-off-by: Stepan Blyschak <[email protected]>
What I did
Add RemoveCreateOnlyDependency Generator and Validator.

How I did it
Added new validator/generator for handling the lane replacement case. The validator/generator understands that for which create-only fields and their dependencies need to be removed.

How to verify it
Unit Test.
…lem by adding symlinks (#2536)

- What I did
Currently the dfw dumps which are usually saved under /var/log/mellanox/sdk-dumps are collect twice in the techsupport. Once under log/ and once under sai_sdk_dump/ folder.

Fixed the scenario by creating a symbolic link from sai_sdk_dump/sai-dfw-xxxxxxxxx.tar.gz -> ../log/sai-dfw-xxxxxxxxx.tar.gz

- How I did it
dfw dumps are copied from syncd currently, but the logic is updated to collect files from the host if SAI_DUMP_STORE_PATH is mounted on the host
Fixed the duplicate dfw dump collection problems by adding a relative symbolic link from sai-sdk-dump/ -> log/ folder.
fw dump me collection is moved to a new function collect_mellanox_dfw_dumps which in run at the end i.e. after the files under /var/log are saved

- How to verify it
root@switch:/home/admin# show techsupport --verbose
root@switch:/home/admin/sonic_dump_r-lionfish-13_20221202_081958/log# ls -Al | grep dfw
-rw-r--r-- 1 root root  1841061 Dec  2 08:21 sai-dfw-1669685690.tar.gz
root@switch:/home/admin/sonic_dump_r-lionfish-13_20221202_081958/sai_sdk_dump# ls -Al

Signed-off-by: Vivek Reddy Karri <[email protected]>
…erface is portchannel member (#2539)

- What I did
Added a check in config interface ip command to block if the interface is portchannel member

- How I did it
Added check in config handling

- How to verify it
Added UT to verify.
Signed-off-by: maipbui [email protected]
What I did
Update to bullseye to use python 3.9
How I did it
Change pipeline from buster to bullseye
How to verify it
Pass PR build checker
Porting of changes #2542 to 202205

What I did
Fix show route return command to return error code on failure cases. The parameter return_cmd=True in run_command will suppress the return code and return success even in error scenarios.

How I did it
When run command is called with return_cmd = True, modified its return to include return code, which can then be used to assess if there is an error by the caller

How to verify it
Added UT to verify it
…form (#2533)

What I did
Added cisco-8000 specific platform information to "show techsupport" tarfile

How I did it
Added collect_cisco_8000 function to scripts/generate_dump which filters out the wanted files from /usr/share/sonic/device/${platform} and saves them in the techsupport tarfile under sai subdirectory

How to verify it
Run "show techsupport" and grep sai in the generated techsupport tarfile

Signed-off-by: Geert Vlaemynck <[email protected]>
…) (#2552)

* [202205][route_check]: Ignore ASIC only SOC IPs (cherry-picking #2548)

* [tests]: Improve route check test

- Split test into separate methods based on functionality being tested
- Parametrize main test method for better granularity when viewing results/running test cases
- Add config DB mocking support
- Move some setup/teardown code to fixtures for better consistency
- Extract test data to separate file
- Ignore routes for SOC IPs that are only present in the ASIC
- Add test case to cover ASIC only SOC IPs

Signed-off-by: Lawrence Lee <[email protected]>

Signed-off-by: Lawrence Lee <[email protected]>
Co-authored-by: Lawrence Lee <[email protected]>
…kernel into two columns (#2553)

Stemming from sonic-net/sonic-swss#2557.

This PR is to update show mux tunnel-route command to show status of both ASIC and kernel tunnel routes.

sign-off: Jing Zhang [email protected]

What I did
How I did it
How to verify it
Previous command output (if the output of a command-line utility has changed)
Only check Kernel Route, if removing tunnel route for server_ipv4 in kernel, it won't show in CMD output:

zhangjing@********************:~$ show mux tunnel-route Ethernet4
PORT       DEST_TYPE    DEST_ADDRESS
---------  -----------  --------------------------------
Ethernet4  server_ipv6  2603:10b0:d11:8614::a32:9112/128
New command output (if the output of a command-line utility has changed)
Check both ASIC and APP DB for tunnel route status

zhangjing@********************:~$ show mux tunnel-route Ethernet4
PORT       DEST_TYPE    DEST_ADDRESS                      kernel    asic
---------  -----------  --------------------------------  --------  ------
Ethernet4  server_ipv4  10.50.145.18/32                   -         added
Ethernet4  server_ipv6  2603:10b0:d11:8614::a32:9112/128  added     added
…erfaces (#2560)

Fix the issue where cross branch upgrades (base DB version 1_0_1) lead to a OA crash due to a duplicate IP2ME route being added when there are more than one Loopback interfaces.

The issue happens as in current implementation lo is hardcoded to be replaced as Loopback0.
When the base image's APP DB has more than one IP assigned to lo interface, upon migration, all the IPs are assinged to same loopback Loopback0. This is incorrect, as in newer images different IPs are assinged to distinct Loopback interfaces.

How to verify it
Verified on a physical testbed that this change fixes the OA crash issue.
Also added a unit test to catch this issue in PR tests.
…hsupport' script to 5-10% by reducing calls to the 'tar append' operation (#2562)

- What I did
Optimize the execution time of the 'show techsupport' script to 5-10%.

- How I did it
The show techsupport CLI command calls the generate_dump bash script. In the script, there are a many functions that do the next scenario:

1. Run some CLI command
2. Save output from step 1 to the temporary file
3. Append the temporary file from step 2 to the `/var/dump/sonic_dump_XXXX.tar` file
4. Delete the temporary file from step 2
This PR removes the 3 and 4 step from those functions and creates a new function save_to_tar() which will add to .tar archive the whole directory with temporary files (which means it will not spawn a tar -v -rhf ... process for each temporary file)

- How to verify it
Run the time show techsupport CLI command and compare the execution time to the original script, the execution time will be decreased by 5-10%.

Signed-off-by: Vadym Hlushko <[email protected]>
…ce in default-vrf (#2564)

* Fixes #12170: Delete subinterface and recreate the subinterface  in default-vrf while unbinding subinterface from user defined vrf.
… by paraller function execution (#2565)

- What I did
Optimize the execution time of the 'show techsupport' script.

- How I did it
The show techsupport CLI command calls the generate_dump bash script. In the script, there are a many functions that do the next scenario:

1. Run some CLI command
2. Save output from step 1 to the temporary file
3. Append the temporary file from step 2 to the `/var/dump/sonic_dump_XXXX.tar` file
4. Delete the temporary file from step 2
This PR will add the execution of these functions in parallel manner. Also, it will not spawn too many processes to not waste all CPU time.

- How to verify it
First test scenario

Run the `time show techsupport` CLI command and compare the execution time to the original script (with no parallelism), the execution time will be decreased by 10-20%.
Second test scenario

1. Stuck the FW by using next commands
	a. mcra /dev/mst/mt52100_pci_cr0 0xa01e4 0x10
	b. mcra /dev/mst/mt52100_pci_cr0 0xa05e4 0x10
	c. mcra /dev/mst/mt52100_pci_cr0 0xa07e4 0x10
	d. mcra /dev/mst/mt52100_pci_cr0 0xa09e4 0x10
	e. mcra /dev/mst/mt52100_pci_cr0 0xa0be4 0x10
	f. mcra /dev/mst/mt52100_pci_cr0 0xa0de4 0x10
	g. mcra /dev/mst/mt52100_pci_cr0 0xa0fe4 0x10
2. Run the `time show techsupport` CLI command and compare the execution time to the original script (with no parallelism), the execution time will be decreased by up to 50% because inside the script we launch CLI commands with `timeout --foreground 5m`. 

Signed-off-by: Vadym Hlushko <[email protected]>
- What I did
I fixed the timer unit template to account "wanted-by" option in the manifest. In case service is delayed, "wanted-by" is applied to the timer unit that delays it.

- How I did it
I updated timer.unit.j2 template

- How to verify it
Make sure that "WantedBy" is rendered in the timer unit.

Signed-off-by: Stepan Blyschak <[email protected]>
…#2568)

This is to cherry-pick #2556 to 202205
All the PGs between minimal and maximal indexes are displayed regardless of whether they are configured.
Originally, watermark counters were enabled for all PGs, so there is no issue.
Now, watermark counters are enabled only for PGs with buffer configured, eg. if PG 0/2/3/4/6, is configured, PG 0-6 will be displayed, which is confusing by giving users a feeling that PG 7 is lost

- How I did it
Display valid PGs only

- How to verify it
Manually test and unit test.

- Previous command output (if the output of a command-line utility has changed)
       Port    PG0    PG1    PG2    PG3    PG4
-----------  -----  -----  -----  -----  -----
 Ethernet0      0      0      0      0      0
 Ethernet2      0      0      0      0      0
 Ethernet8      0      0      0      0      0
Ethernet10      0      0      0      0      0
Ethernet16      0      0      0      0      0
Ethernet18      0      0      0      0      0
Ethernet32      0      0      0      0      0

- New command output (if the output of a command-line utility has changed)
PG1 won't be displayed if it is not configured

       Port    PG0    PG3    PG4
-----------  -----  -----  -----
 Ethernet0      0      0      0
 Ethernet2      0      0      0
 Ethernet8      0      0      0
Ethernet10      0      0      0
Ethernet16      0      0      0
Ethernet18      0      0      0
Ethernet32      0      0      0

Signed-off-by: Stephen Sun <[email protected]>
…in the techsupport dump (#2572)

- What I did
Fixed a deletion flow for all secret files in the tech support dump.

- How I did it
Delete files by using the find and rm Linux utilities.

- How to verify it
Run the show_techsupport/test_techsupport_no_secret.py

Signed-off-by: Vadym Hlushko <[email protected]>
…tor when unable to fetch DEVICE_METADATA due to empty CONFIG_DB during initialization (#2569) (#2570)

- What I did
It is expected that db_migrator is not able to fetch DEVICE_METADATA when it is invoked before the CONFIG_DB is initialized. In this case, we should not use ERROR to log the message since it's not an error.
Change the severity to NOTICE

- How I did it
Change the severity.

- How to verify it
Manually test.

Signed-off-by: Stephen Sun <[email protected]>

Signed-off-by: Stephen Sun <[email protected]>
…grating packages (#2573) (#2575)

What I did
SONiC package migration has been failing due to the lack of DNS configuration for registries domain names.
I used /etc/resolv.conf from host OS when migrating.

Based on PR #2573

How I did it
Copy /etc/resolv.conf into new image filesystem during migration, then, restore it back.

How to verify it
Run sonic-installer install.
- What I did
Preserve COPP table contents through DB migration. (Mellanox only)

- How I did it
Skipped deleting of COPP tables in DB migrator

- How to verify it
Observe COPP table contents are preserved right after reboot
…or (#2176)

- What I did
Add sonic-delayed.target to sonic-application-extension .timer file generator
This change will complete sonic-net/sonic-buildimage#7846 of sonic-delayed.target addition.

- How I did it
N/A

- How to verify it
Make sure your App Ext is part of "WantedBy" sonic-delayed.target
- What I did
Reverted PRs because they caused the degradation that some files are missing in show techsupport archive.

- How I did it
Reverts the following 
e1c8243 [202205][generate_dump] Fix for a deletion flow for all secret files in the techsupport dump (#2572)
f45dcfb [generate_dump] Optimize the execution time of 'show techsupport' CLI by paraller function execution (#2565)
93172c4 [202205] [generate_dump] Optimize the execution time of the 'show techsupport' script to 5-10% by reducing calls to the 'tar append' operation (#2562)
Signed-off-by: kannankvs <[email protected]>

Signed-off-by: kannankvs <[email protected]>
… voq statistics (#2591)

* Enhanced queue stat to add an option to display voq statistics. When voq option is
  given look at COUNTERS_SYSTEM_PORT_NAME_MAP and COUNTERS_VOQ_NAME_MAP to derive
  the queue information to lookup. Added a modified header for voq statistics.

* Added a unit test for the new voq option.
What I did
Add linkprober category to story teller. It will reflect dualtor heartbeat events.

sign-off: Jing Zhang [email protected]

How to verify it
Tested on dualtor device, was able to grep link prober state change events.
This is a PR against 202205 based on the following PR: #2577
Due to an issue of fallback from to cold-boot when using upgrade with fast-reboot combined with FW upgrade a short term solution is to extend the timer.
An issue will be opened on this case with the full details, link will be added to the PR.
Long term solution of using fast-reboot finalizer replacing the timer is in work.

What I did
Extend the timer of STATE DB fast-reboot entry to 210 seconds.

How I did it
Modify the TTL of the entry set in STATE DB.

How to verify it
Verify the entry was preserved for 210 seconds.
…ER_DOM_THRESHOLD table (#2535)

* EEPROM CLI support to dump output from TRANSCEIVER_DOM_THRESHOLD table

Signed-off-by: Mihir Patel <[email protected]>

* Resolved test failures

Signed-off-by: Mihir Patel <[email protected]>

Signed-off-by: Mihir Patel <[email protected]>
#### What I did
Add bgpraw output to `show runningconfiguration all`
```
Requirements:
1. current `show runningconfig` will print all the ConfigDB in a json format, we need to add a new key-value into the json output "bgpraw" with a long string value
2. The long string value should be the output of `vtysh -c "show run"`. It is normally multiline string, may include special characters like \". Need to make sure the escaping properly
3. We do not need to insert the key-value into ConfigDB is not existing there
4. If ConfigDB already has the key-value, we do not need to override it by vtysh command output
5. Not break multi-asic use
```
#### How I did it
Generate bgpraw output then append it to `show runnningconfiguration all`'s output
#### How to verify it
Mannual test
#### Previous command output (if the output of a command-line utility has changed)
```
admin@vlab-01:~$ show run all
{
    "ACL_TABLE": {
......
    "WRED_PROFILE": {
        "AZURE_LOSSLESS": {
            "ecn": "ecn_all",
            "green_drop_probability": "5",
            "green_max_threshold": "2097152",
            "green_min_threshold": "1048576",
            "red_drop_probability": "5",
            "red_max_threshold": "2097152",
            "red_min_threshold": "1048576",
            "wred_green_enable": "true",
            "wred_red_enable": "true",
            "wred_yellow_enable": "true",
            "yellow_drop_probability": "5",
            "yellow_max_threshold": "2097152",
            "yellow_min_threshold": "1048576"
        }
    }
}
```
#### New command output (if the output of a command-line utility has changed)
```
admin@vlab-01:~$ show run all
{
    "ACL_TABLE": {
......
    "WRED_PROFILE": {
        "AZURE_LOSSLESS": {
            "ecn": "ecn_all",
            "green_drop_probability": "5",
            "green_max_threshold": "2097152",
            "green_min_threshold": "1048576",
            "red_drop_probability": "5",
            "red_max_threshold": "2097152",
            "red_min_threshold": "1048576",
            "wred_green_enable": "true",
            "wred_red_enable": "true",
            "wred_yellow_enable": "true",
            "yellow_drop_probability": "5",
            "yellow_max_threshold": "2097152",
            "yellow_min_threshold": "1048576"
        }
    },
    "bgpraw": "Building configuration...\n\nCurrent configuration......end\n"
}
```
mihirpat1 and others added 28 commits March 13, 2024 07:01
[code sync] Merge code from sonic-net/sonic-utilities.msft:202205 to 202205
…age support for VS (#3250)

### What I did
For T2-Chassis VS support, we are adding new sonic_platform package for vs platforms. Please refer sonic-net/sonic-buildimage#18512 for more details.
Due to this new platform package, need to modify excpetion handling as now the Module would be found, but the metadata file will not be found for pizzabox vs platforms.

#### How I did it
Modified the exception handling logic.
MSFT ADO: 27414904

#### How to verify it
Bring up vms-kvm-t0 topology. ran show interface status. The output is proper.

PS: the Main PR(sonic-net/sonic-buildimage#18512) is dependent on this PR to be merged in first.
T2-VOQ-VS: Modified exception handling due to new sonic_platform pack…
…l reboot (#3292)

* [chassis][midplane] Add notification to Supervisor when LC is graceful reboot

* Address review comment by adding log message when failed to create wentry in CHASSIS_STATE_DB

Signed-off-by: mlok <[email protected]>
[show] Show running config when bgp is down
[chassis][midplane] Add notification to Supervisor when LC is gracefu…
…ule(SFM) by using "config chassis modules shutdown/startup" commands (#3283)

sudo config chassis modules shutdown/startup <module name>

The HLD for Shutdown and Startup of the Fabric Module is below:
sonic-net/SONiC#1694
Update for the procedures for insertion/hot swap of Switch Fabric Mod…
…en urllib3 and requests packages (#3328) (#3355)

Co-authored-by: Oleksandr Ivantsiv <[email protected]>
[code sync] Merge code from sonic-net/sonic-utilities.msft:202205 to 202205
[chassis][show-runningconfig] Fix the show runningconfiguration all i…
#### What I did

Before apply the json patch, we will precheck and simulate-patch the payload in entire box level.

#### How I did it

1. Add Duplication check
2. JSON patch structure validating
3. Simulating patch to full configuration
4. Verifying simulating result match YANG validation.

#### How to verify it

1. Single ASIC

```
admin@str2-msn2700-spy-2:~/gcu$ cat empty.json
[]
admin@str2-msn2700-spy-2:~/gcu$ sudo config apply-patch empty.json
Patch Applier: localhost: Patch application starting.
Patch Applier: localhost: Patch: []
Patch Applier: localhost getting current config db.
Patch Applier: localhost: simulating the target full config after applying the patch.
Patch Applier: localhost: validating all JsonPatch operations are permitted on the specified fields
Patch Applier: localhost: validating target config does not have empty tables,
                               since they do not show up in ConfigDb.
Patch Applier: localhost: sorting patch updates.
Patch Applier: The localhost patch was converted into 0 changes.
Patch Applier: localhost: applying 0 changes in order.
Patch Applier: localhost: verifying patch updates are reflected on ConfigDB.
Patch Applier: localhost patch application completed.
Patch applied successfully.
```

2. Multi ASIC

```
stli@str2-7250-2-lc01:~/gcu$ cat empty.json
[]
stli@str2-7250-2-lc01:~/gcu$ sudo config apply-patch empty.json
sonic_yang(6):Note: Below table(s) have no YANG models: DHCP_SERVER, KUBERNETES_MASTER
sonic_yang(6):Note: Below table(s) have no YANG models: KUBERNETES_MASTER
sonic_yang(6):Note: Below table(s) have no YANG models: KUBERNETES_MASTER
Patch Applier: localhost: Patch application starting.
Patch Applier: localhost: Patch: []
Patch Applier: localhost getting current config db.
Patch Applier: localhost: simulating the target full config after applying the patch.
Patch Applier: localhost: validating all JsonPatch operations are permitted on the specified fields
Patch Applier: localhost: validating target config does not have empty tables,
                               since they do not show up in ConfigDb.
Patch Applier: localhost: sorting patch updates.
Patch Applier: The localhost patch was converted into 0 changes.
Patch Applier: localhost: applying 0 changes in order.
Patch Applier: localhost: verifying patch updates are reflected on ConfigDB.
Patch Applier: localhost patch application completed.
Patch Applier: asic0: Patch application starting.
Patch Applier: asic0: Patch: []
Patch Applier: asic0 getting current config db.
Patch Applier: asic0: simulating the target full config after applying the patch.
Patch Applier: asic0: validating all JsonPatch operations are permitted on the specified fields
Patch Applier: asic0: validating target config does not have empty tables,
                               since they do not show up in ConfigDb.
Patch Applier: asic0: sorting patch updates.
Patch Applier: The asic0 patch was converted into 0 changes.
Patch Applier: asic0: applying 0 changes in order.
Patch Applier: asic0: verifying patch updates are reflected on ConfigDB.
Patch Applier: asic0 patch application completed.
Patch Applier: asic1: Patch application starting.
Patch Applier: asic1: Patch: []
Patch Applier: asic1 getting current config db.
Patch Applier: asic1: simulating the target full config after applying the patch.
Patch Applier: asic1: validating all JsonPatch operations are permitted on the specified fields
Patch Applier: asic1: validating target config does not have empty tables,
                               since they do not show up in ConfigDb.
Patch Applier: asic1: sorting patch updates.
Patch Applier: The asic1 patch was converted into 0 changes.
Patch Applier: asic1: applying 0 changes in order.
Patch Applier: asic1: verifying patch updates are reflected on ConfigDB.
Patch Applier: asic1 patch application completed.
Patch applied successfully.
```
…k-3316-and-3299

Cherry pick 3316 and 3299
Copy link

CLA Missing ID CLA Not Signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.