Skip to content

Commit 17d5929

Browse files
itamar-talmonItamar Talmon
authored and
Itamar Talmon
committed
Merge branch 'master' into front_panel_port_name_regex
2 parents d72b145 + 8389c81 commit 17d5929

Some content is hidden

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

55 files changed

+3399
-471
lines changed

.azure-pipelines/build-docker-sonic-vs-template.yml

-65
This file was deleted.

.azure-pipelines/test-docker-sonic-vs-template.yml

-92
This file was deleted.

azure-pipelines.yml

-16
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,3 @@ stages:
125125
- publish: '$(System.DefaultWorkingDirectory)/dist/'
126126
artifact: wheels
127127
displayName: "Publish Python wheels"
128-
129-
- stage: BuildDocker
130-
dependsOn: Build
131-
condition: succeeded('Build')
132-
jobs:
133-
- template: .azure-pipelines/build-docker-sonic-vs-template.yml
134-
parameters:
135-
artifact_name: docker-sonic-vs
136-
137-
- stage: Test
138-
dependsOn: BuildDocker
139-
condition: succeeded('BuildDocker')
140-
jobs:
141-
- template: .azure-pipelines/test-docker-sonic-vs-template.yml
142-
parameters:
143-
log_artifact_name: log

config/main.py

+19-6
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,19 @@ def validate_ipv4_address(ctx, param, ip_addr):
10241024
except ValueError as e:
10251025
raise click.UsageError(str(e))
10261026

1027+
def validate_gre_type(ctx, _, value):
1028+
"""A validator for validating input gre_type
1029+
"""
1030+
try:
1031+
base = 10
1032+
if value.lower().startswith('0x'):
1033+
base = 16
1034+
gre_type_value = int(value, base)
1035+
if gre_type_value < GRE_TYPE_RANGE.min or gre_type_value > GRE_TYPE_RANGE.max:
1036+
raise click.UsageError("{} is not a valid GRE type".format(value))
1037+
return gre_type_value
1038+
except ValueError:
1039+
raise click.UsageError("{} is not a valid GRE type".format(value))
10271040

10281041
# This is our main entrypoint - the main 'config' command
10291042
@click.group(cls=clicommon.AbbreviationGroup, context_settings=CONTEXT_SETTINGS)
@@ -1790,11 +1803,11 @@ def add_portchannel_member(ctx, portchannel_name, port_name):
17901803
ctx.fail("{} is not present.".format(portchannel_name))
17911804

17921805
# Dont allow a port to be member of port channel if it is configured with an IP address
1793-
for key in db.get_table('INTERFACE').keys():
1794-
if type(key) != tuple:
1806+
for key,value in db.get_table('INTERFACE').items():
1807+
if type(key) == tuple:
17951808
continue
1796-
if key[0] == port_name:
1797-
ctx.fail(" {} has ip address {} configured".format(port_name, key[1]))
1809+
if key == port_name:
1810+
ctx.fail(" {} has ip address configured".format(port_name))
17981811
return
17991812

18001813
# Dont allow a port to be member of port channel if it is configured as a VLAN member
@@ -1893,7 +1906,7 @@ def mirror_session():
18931906
@click.argument('dst_ip', metavar='<dst_ip>', callback=validate_ipv4_address, required=True)
18941907
@click.argument('dscp', metavar='<dscp>', type=DSCP_RANGE, required=True)
18951908
@click.argument('ttl', metavar='<ttl>', type=TTL_RANGE, required=True)
1896-
@click.argument('gre_type', metavar='[gre_type]', type=GRE_TYPE_RANGE, required=False)
1909+
@click.argument('gre_type', metavar='[gre_type]', callback=validate_gre_type, required=False)
18971910
@click.argument('queue', metavar='[queue]', type=QUEUE_RANGE, required=False)
18981911
@click.option('--policer')
18991912
def add(session_name, src_ip, dst_ip, dscp, ttl, gre_type, queue, policer):
@@ -1917,7 +1930,7 @@ def erspan(ctx):
19171930
@click.argument('dst_ip', metavar='<dst_ip>', callback=validate_ipv4_address,required=True)
19181931
@click.argument('dscp', metavar='<dscp>', type=DSCP_RANGE, required=True)
19191932
@click.argument('ttl', metavar='<ttl>', type=TTL_RANGE, required=True)
1920-
@click.argument('gre_type', metavar='[gre_type]', type=GRE_TYPE_RANGE, required=False)
1933+
@click.argument('gre_type', metavar='[gre_type]', callback=validate_gre_type, required=False)
19211934
@click.argument('queue', metavar='[queue]', type=QUEUE_RANGE, required=False)
19221935
@click.argument('src_port', metavar='[src_port]', required=False)
19231936
@click.argument('direction', metavar='[direction]', required=False)

config/mclag.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def is_ipv4_addr_valid(addr):
8585

8686

8787
def check_if_interface_is_valid(db, interface_name):
88-
from main import interface_name_is_valid
88+
from .main import interface_name_is_valid
8989
if interface_name_is_valid(db,interface_name) is False:
9090
ctx.fail("Interface name is invalid. Please enter a valid interface name!!")
9191

0 commit comments

Comments
 (0)