Skip to content

Commit 4adca3e

Browse files
Merge branch 'port-auto-neg' of github.com:Junchao-Mellanox/sonic-utilities into port-auto-neg
2 parents 7c5273a + 8eaf2e8 commit 4adca3e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+8582
-60
lines changed

config/main.py

+540
Large diffs are not rendered by default.

counterpoll/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def disable():
129129
@click.pass_context
130130
def pg_drop(ctx):
131131
""" Ingress PG drop counter commands """
132-
ctx.obj = swsssdk.ConfigDBConnector()
132+
ctx.obj = ConfigDBConnector()
133133
ctx.obj.connect()
134134

135135
@pg_drop.command()

doc/Command-Reference.md

+317-1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
* [Watermark Show commands](#watermark-show-commands)
144144
* [Watermark Config commands](#watermark-config-commands)
145145
* [Software Installation and Management](#software-installation-and-management)
146+
* [SONiC Package Manager](#sonic-package-manager)
146147
* [SONiC Installer](#sonic-installer)
147148
* [Troubleshooting Commands](#troubleshooting-commands)
148149
* [Routing Stack](#routing-stack)
@@ -8088,8 +8089,316 @@ Go Back To [Beginning of the document](#) or [Beginning of this section](#waterm
80888089
80898090
## Software Installation and Management
80908091
8091-
SONiC software can be installed in two methods, viz, "using sonic-installer tool", "ONIE Installer".
8092+
SONiC images can be installed in one of two methods:
8093+
1. From within a running SONiC image using the `sonic-installer` utility
8094+
2. From the vendor's bootloader (E.g., ONIE, Aboot, etc.)
80928095
8096+
SONiC packages are available as prebuilt Docker images and meant to be installed with the *sonic-package-manager* utility.
8097+
8098+
### SONiC Package Manager
8099+
8100+
The *sonic-package-manager* is a command line tool to manage (e.g. install, upgrade or uninstall) SONiC Packages.
8101+
8102+
**sonic-package-manager list**
8103+
8104+
This command lists all available SONiC packages, their desription, installed version and installation status.
8105+
SONiC package status can be *Installed*, *Not installed* or *Built-In*. "Built-In" status means that a feature is built-in to SONiC image and can't be upgraded or uninstalled.
8106+
8107+
- Usage:
8108+
```
8109+
sonic-package-manager list
8110+
```
8111+
8112+
- Example:
8113+
```
8114+
admin@sonic:~$ sonic-package-manager list
8115+
Name Repository Description Version Status
8116+
-------------- --------------------------- ---------------------------- --------- --------------
8117+
cpu-report azure/cpu-report CPU report package N/A Not Installed
8118+
database docker-database SONiC database package 1.0.0 Built-In
8119+
dhcp-relay azure/docker-dhcp-relay SONiC dhcp-relay package 1.0.0 Installed
8120+
fpm-frr docker-fpm-frr SONiC fpm-frr package 1.0.0 Built-In
8121+
lldp docker-lldp SONiC lldp package 1.0.0 Built-In
8122+
macsec docker-macsec SONiC macsec package 1.0.0 Built-In
8123+
mgmt-framework docker-sonic-mgmt-framework SONiC mgmt-framework package 1.0.0 Built-In
8124+
nat docker-nat SONiC nat package 1.0.0 Built-In
8125+
pmon docker-platform-monitor SONiC pmon package 1.0.0 Built-In
8126+
radv docker-router-advertiser SONiC radv package 1.0.0 Built-In
8127+
sflow docker-sflow SONiC sflow package 1.0.0 Built-In
8128+
snmp docker-snmp SONiC snmp package 1.0.0 Built-In
8129+
swss docker-orchagent SONiC swss package 1.0.0 Built-In
8130+
syncd docker-syncd-mlnx SONiC syncd package 1.0.0 Built-In
8131+
teamd docker-teamd SONiC teamd package 1.0.0 Built-In
8132+
telemetry docker-sonic-telemetry SONiC telemetry package 1.0.0 Built-In
8133+
```
8134+
8135+
**sonic-package-manager repository add**
8136+
8137+
This command will add a new repository as source for SONiC packages to the database. *NOTE*: requires elevated (root) privileges to run
8138+
8139+
- Usage:
8140+
```
8141+
Usage: sonic-package-manager repository add [OPTIONS] NAME REPOSITORY
8142+
8143+
Add a new repository to database.
8144+
8145+
NOTE: This command requires elevated (root) privileges to run.
8146+
8147+
Options:
8148+
--default-reference TEXT Default installation reference. Can be a tag or
8149+
sha256 digest in repository.
8150+
--description TEXT Optional package entry description.
8151+
--help Show this message and exit.
8152+
```
8153+
- Example:
8154+
```
8155+
admin@sonic:~$ sudo sonic-package-manager repository add \
8156+
cpu-report azure/sonic-cpu-report --default-reference 1.0.0
8157+
```
8158+
8159+
**sonic-package-manager repository remove**
8160+
8161+
This command will remove a repository as source for SONiC packages from the database . The package has to be *Not Installed* in order to be removed from package database. *NOTE*: requires elevated (root) privileges to run
8162+
8163+
- Usage:
8164+
```
8165+
Usage: sonic-package-manager repository remove [OPTIONS] NAME
8166+
8167+
Remove repository from database.
8168+
8169+
NOTE: This command requires elevated (root) privileges to run.
8170+
8171+
Options:
8172+
--help Show this message and exit.
8173+
```
8174+
- Example:
8175+
```
8176+
admin@sonic:~$ sudo sonic-package-manager repository remove cpu-report
8177+
```
8178+
8179+
**sonic-package-manager install**
8180+
8181+
This command pulls and installs a package on SONiC host. *NOTE*: this command requires elevated (root) privileges to run
8182+
8183+
- Usage:
8184+
```
8185+
Usage: sonic-package-manager install [OPTIONS] [PACKAGE_EXPR]
8186+
8187+
Install/Upgrade package using [PACKAGE_EXPR] in format
8188+
"<name>[=<version>|@<reference>]".
8189+
8190+
The repository to pull the package from is resolved by lookup in
8191+
package database, thus the package has to be added via "sonic-
8192+
package-manager repository add" command.
8193+
8194+
In case when [PACKAGE_EXPR] is a package name "<name>" this command
8195+
will install or upgrade to a version referenced by "default-
8196+
reference" in package database.
8197+
8198+
NOTE: This command requires elevated (root) privileges to run.
8199+
8200+
Options:
8201+
--enable Set the default state of the feature to enabled
8202+
and enable feature right after installation. NOTE:
8203+
user needs to execute "config save -y" to make
8204+
this setting persistent.
8205+
--set-owner [local|kube] Default owner configuration setting for a feature.
8206+
--from-repository TEXT Fetch package directly from image registry
8207+
repository. NOTE: This argument is mutually
8208+
exclusive with arguments: [package_expr,
8209+
from_tarball].
8210+
--from-tarball FILE Fetch package from saved image tarball. NOTE: This
8211+
argument is mutually exclusive with arguments:
8212+
[package_expr, from_repository].
8213+
-f, --force Force operation by ignoring package dependency
8214+
tree and package manifest validation failures.
8215+
-y, --yes Automatically answer yes on prompts.
8216+
-v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO or DEBUG.
8217+
Default is INFO.
8218+
--skip-host-plugins Do not install host OS plugins provided by the
8219+
package (CLI, etc). NOTE: In case when package
8220+
host OS plugins are set as mandatory in package
8221+
manifest this option will fail the installation.
8222+
--allow-downgrade Allow package downgrade. By default an attempt to
8223+
downgrade the package will result in a failure
8224+
since downgrade might not be supported by the
8225+
package, thus requires explicit request from the
8226+
user.
8227+
--help Show this message and exit..
8228+
```
8229+
- Example:
8230+
```
8231+
admin@sonic:~$ sudo sonic-package-manager install dhcp-relay=1.0.2
8232+
```
8233+
```
8234+
admin@sonic:~$ sudo sonic-package-manager install dhcp-relay@latest
8235+
```
8236+
```
8237+
admin@sonic:~$ sudo sonic-package-manager install dhcp-relay@sha256:9780f6d83e45878749497a6297ed9906c19ee0cc48cc88dc63827564bb8768fd
8238+
```
8239+
```
8240+
admin@sonic:~$ sudo sonic-package-manager install --from-repository azure/sonic-cpu-report:latest
8241+
```
8242+
```
8243+
admin@sonic:~$ sudo sonic-package-manager install --from-tarball sonic-docker-image.gz
8244+
```
8245+
8246+
**sonic-package-manager uninstall**
8247+
8248+
This command uninstalls package from SONiC host. User needs to stop the feature prior to uninstalling it.
8249+
*NOTE*: this command requires elevated (root) privileges to run.
8250+
8251+
- Usage:
8252+
```
8253+
Usage: sonic-package-manager uninstall [OPTIONS] NAME
8254+
8255+
Uninstall package.
8256+
8257+
NOTE: This command requires elevated (root) privileges to run.
8258+
8259+
Options:
8260+
-f, --force Force operation by ignoring package dependency tree and
8261+
package manifest validation failures.
8262+
-y, --yes Automatically answer yes on prompts.
8263+
-v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO or DEBUG. Default
8264+
is INFO.
8265+
--help Show this message and exit.
8266+
```
8267+
- Example:
8268+
```
8269+
admin@sonic:~$ sudo sonic-package-manager uninstall dhcp-relay
8270+
```
8271+
8272+
**sonic-package-manager reset**
8273+
8274+
This comamnd resets the package by reinstalling it to its default version. *NOTE*: this command requires elevated (root) privileges to run.
8275+
8276+
- Usage:
8277+
```
8278+
Usage: sonic-package-manager reset [OPTIONS] NAME
8279+
8280+
Reset package to the default version.
8281+
8282+
NOTE: This command requires elevated (root) privileges to run.
8283+
8284+
Options:
8285+
-f, --force Force operation by ignoring package dependency tree and
8286+
package manifest validation failures.
8287+
-y, --yes Automatically answer yes on prompts.
8288+
-v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO or DEBUG. Default
8289+
is INFO.
8290+
--skip-host-plugins Do not install host OS plugins provided by the package
8291+
(CLI, etc). NOTE: In case when package host OS plugins
8292+
are set as mandatory in package manifest this option
8293+
will fail the installation.
8294+
--help Show this message and exit.
8295+
```
8296+
- Example:
8297+
```
8298+
admin@sonic:~$ sudo sonic-package-manager reset dhcp-relay
8299+
```
8300+
8301+
**sonic-package-manager show package versions**
8302+
8303+
This command will retrieve a list of all available versions for the given package from the configured upstream repository
8304+
8305+
- Usage:
8306+
```
8307+
Usage: sonic-package-manager show package versions [OPTIONS] NAME
8308+
8309+
Show available versions.
8310+
8311+
Options:
8312+
--all Show all available tags in repository.
8313+
--plain Plain output.
8314+
--help Show this message and exit.
8315+
```
8316+
- Example:
8317+
```
8318+
admin@sonic:~$ sonic-package-manager show package versions dhcp-relay
8319+
• 1.0.0
8320+
• 1.0.2
8321+
• 2.0.0
8322+
```
8323+
```
8324+
admin@sonic:~$ sonic-package-manager show package versions dhcp-relay --plain
8325+
1.0.0
8326+
1.0.2
8327+
2.0.0
8328+
```
8329+
```
8330+
admin@sonic:~$ sonic-package-manager show package versions dhcp-relay --all
8331+
• 1.0.0
8332+
• 1.0.2
8333+
• 2.0.0
8334+
• latest
8335+
```
8336+
8337+
**sonic-package-manager show package changelog**
8338+
8339+
This command fetches the changelog from the package manifest and displays it. *NOTE*: package changelog can be retrieved from registry or read from image tarball without installing it.
8340+
8341+
- Usage:
8342+
```
8343+
Usage: sonic-package-manager show package changelog [OPTIONS] [PACKAGE_EXPR]
8344+
8345+
Show package changelog.
8346+
8347+
Options:
8348+
--from-repository TEXT Fetch package directly from image registry
8349+
repository NOTE: This argument is mutually exclusive
8350+
with arguments: [from_tarball, package_expr].
8351+
--from-tarball FILE Fetch package from saved image tarball NOTE: This
8352+
argument is mutually exclusive with arguments:
8353+
[package_expr, from_repository].
8354+
--help Show this message and exit.
8355+
```
8356+
- Example:
8357+
```
8358+
admin@sonic:~$ sonic-package-manager show package changelog dhcp-relay
8359+
1.0.0:
8360+
8361+
• Initial release
8362+
8363+
Author ([email protected]) Mon, 25 May 2020 12:25:00 +0300
8364+
```
8365+
8366+
**sonic-package-manager show package manifest**
8367+
8368+
This command fetches the package manifest and displays it. *NOTE*: package manifest can be retrieved from registry or read from image tarball without installing it.
8369+
8370+
- Usage:
8371+
```
8372+
Usage: sonic-package-manager show package manifest [OPTIONS] [PACKAGE_EXPR]
8373+
8374+
Show package manifest.
8375+
8376+
Options:
8377+
--from-repository TEXT Fetch package directly from image registry
8378+
repository NOTE: This argument is mutually exclusive
8379+
with arguments: [package_expr, from_tarball].
8380+
--from-tarball FILE Fetch package from saved image tarball NOTE: This
8381+
argument is mutually exclusive with arguments:
8382+
[from_repository, package_expr].
8383+
-v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO or DEBUG
8384+
--help Show this message and exit.
8385+
```
8386+
- Example:
8387+
```
8388+
admin@sonic:~$ sonic-package-manager show package manifest dhcp-relay=2.0.0
8389+
{
8390+
"version": "1.0.0",
8391+
"package": {
8392+
"version": "2.0.0",
8393+
"depends": [
8394+
"database>=1.0.0,<2.0.0"
8395+
]
8396+
},
8397+
"service": {
8398+
"name": "dhcp_relay"
8399+
}
8400+
}
8401+
```
80938402
80948403
### SONiC Installer
80958404
This is a command line tool available as part of the SONiC software; If the device is already running the SONiC software, this tool can be used to install an alternate image in the partition.
@@ -8160,6 +8469,13 @@ This command is used to install a new image on the alternate image partition. T
81608469
Done
81618470
```
81628471
8472+
Installing a new image using the sonic-installer will keep using the packages installed on the currently running SONiC image and automatically migrate those. In order to perform clean SONiC installation use the *--skip-package-migration* option:
8473+
8474+
- Example:
8475+
```
8476+
admin@sonic:~$ sudo sonic-installer install https://sonic-jenkins.westus.cloudapp.azure.com/job/xxxx/job/buildimage-xxxx-all/xxx/artifact/target/sonic-xxxx.bin --skip-package-migration
8477+
```
8478+
81638479
**sonic-installer set_default**
81648480
81658481
This command is be used to change the image which can be loaded by default in all the subsequent reboots.

scripts/neighbor_advertiser

+14-4
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,11 @@ def get_loopback_addr(ip_ver):
169169
def get_vlan_interfaces():
170170
vlan_info = config_db.get_table('VLAN')
171171
vlan_interfaces = []
172-
172+
vlan_intfs = config_db.get_table('VLAN_INTERFACE')
173+
# Skip L2 VLANs
173174
for vlan_name in vlan_info:
174-
vlan_interfaces.append(vlan_name)
175+
if vlan_name in vlan_intfs:
176+
vlan_interfaces.append(vlan_name)
175177

176178
return vlan_interfaces
177179

@@ -502,6 +504,14 @@ def reset_mirror_tunnel():
502504
# Set vxlan tunnel
503505
#
504506

507+
def check_existing_tunnel():
508+
vxlan_tunnel = config_db.get_table('VXLAN_TUNNEL')
509+
if len(vxlan_tunnel):
510+
global VXLAN_TUNNEL_NAME
511+
VXLAN_TUNNEL_NAME = list(vxlan_tunnel.keys())[0]
512+
return True
513+
return False
514+
505515
def add_vxlan_tunnel(dst_ipv4_addr):
506516
vxlan_tunnel_info = {
507517
'src_ip': get_loopback_addr(4),
@@ -517,12 +527,12 @@ def add_vxlan_tunnel_map():
517527
'vni': get_vlan_interface_vxlan_id(vlan_intf_name),
518528
'vlan': vlan_intf_name
519529
}
520-
521530
config_db.set_entry('VXLAN_TUNNEL_MAP', (VXLAN_TUNNEL_NAME, VXLAN_TUNNEL_MAP_PREFIX + str(index)), vxlan_tunnel_map_info)
522531

523532

524533
def set_vxlan_tunnel(ferret_server_ip):
525-
add_vxlan_tunnel(ferret_server_ip)
534+
if not check_existing_tunnel():
535+
add_vxlan_tunnel(ferret_server_ip)
526536
add_vxlan_tunnel_map()
527537
log.log_info('Finish setting vxlan tunnel; Ferret: {}'.format(ferret_server_ip))
528538

0 commit comments

Comments
 (0)