Skip to content

Commit

Permalink
Merge branch 'Azure:master' into config_validate
Browse files Browse the repository at this point in the history
  • Loading branch information
ganglyu authored Jan 11, 2022
2 parents c27192c + 9b795db commit 5704bc9
Show file tree
Hide file tree
Showing 19 changed files with 681 additions and 9 deletions.
2 changes: 1 addition & 1 deletion sonic-slave-bullseye/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ RUN pip3 install "PyYAML==5.4.1"
RUN pip3 install "lxml==4.6.2"

# For sonic-platform-common testing
RUN pip3 install redis==3.5.3
RUN pip3 install redis

# For vs image build
RUN pip3 install pexpect==4.8.0
Expand Down
2 changes: 1 addition & 1 deletion sonic-slave-buster/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ RUN pip2 install "lxml==4.6.5"
RUN pip3 install "lxml==4.6.5"
# For sonic-platform-common testing
RUN pip3 install redis==3.5.3
RUN pip3 install redis
# For vs image build
RUN pip2 install pexpect==4.6.0
Expand Down
2 changes: 1 addition & 1 deletion sonic-slave-stretch/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ RUN pip3 install "lxml==4.6.5"
# For sonic-platform-common testing
RUN pip3 install redis==3.5.3
RUN pip3 install redis
# For vs image build
RUN pip2 install pexpect==4.6.0
Expand Down
50 changes: 50 additions & 0 deletions src/sonic-host-services/host_modules/showtech.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""Show techsupport command handler"""

import host_service
import subprocess
import re

MOD_NAME = 'showtech'

class Showtech(host_service.HostModule):
"""DBus endpoint that executes the "show techsupport" command
"""
@host_service.method(host_service.bus_name(MOD_NAME), in_signature='s', out_signature='is')
def info(self, date):

ERROR_TAR_FAILED = 5
ERROR_PROCFS_SAVE_FAILED = 6
ERROR_INVALID_ARGUMENT = 10

err_dict = {ERROR_INVALID_ARGUMENT: 'Invalid input: Incorrect DateTime format',
ERROR_TAR_FAILED: 'Failure saving information into compressed output file',
ERROR_PROCFS_SAVE_FAILED: 'Saving of process information failed'}

cmd = ['/usr/local/bin/generate_dump']
if date:
cmd.append("-s")
cmd.append(date)

try:
result = subprocess.run(cmd, capture_output=True, text=True,
check=True)

except subprocess.CalledProcessError as err:
errmsg = err_dict.get(err.returncode)

if errmsg is None:
output = 'Error: Failure code {:-5}'.format(err.returncode)
else:
output = errmsg

print("%Error: Host side: Failed: " + str(err.returncode))
return err.returncode, output

output_file_match = re.search('\/var\/.*dump.*\.gz', result.stdout)
output_filename = output_file_match.group()
return result.returncode, output_filename

def register():
"""Return the class name"""
return Showtech, MOD_NAME

1 change: 1 addition & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def run(self):
'./yang-models/sonic-versions.yang',
'./yang-models/sonic-vlan.yang',
'./yang-models/sonic-vrf.yang',
'./yang-models/sonic-vlan-sub-interface.yang',
'./yang-models/sonic-warm-restart.yang',
'./yang-models/sonic-lldp.yang',
'./yang-models/sonic-scheduler.yang',
Expand Down
16 changes: 16 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,15 @@
"speed": "11100",
"tpid": "0x8100",
"admin_status": "up"
},
"Ethernet120": {
"alias": "Eth31/1",
"lanes": "121,122",
"description": "",
"fec": "fc",
"speed": "11100",
"tpid": "0x8100",
"admin_status": "up"
}
},
"ACL_TABLE": {
Expand Down Expand Up @@ -845,6 +854,13 @@
"family": "IPv4"
}
},
"VLAN_SUB_INTERFACE": {
"Ethernet120.10": {
"admin_status": "up"
},
"Ethernet120.10|10.0.1.56/31": {},
"Ethernet120.10|fc00::1:71/126": {}
},
"VLAN_MEMBER": {
"Vlan111|Ethernet0": {
"tagging_mode": "untagged"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,27 @@
},
"DEVICE_METADATA_CORRECT_CLOUDTYPE_REGION_CONFIG": {
"desc": "Verifying cloudtype and region configuration."
}
},
"DEVICE_METADATA_VALID_SUBTYPE": {
"desc": "Verifying valid subtype value"
},
"DEVICE_METADATA_INVALID_SUBTYPE": {
"desc": "Verifying invalid subtype value",
"eStrKey": "Pattern"
},
"DEVICE_METADATA_VALID_PEER_SWITCH": {
"desc": "Verifying valid peer switch hostname"
},
"DEVICE_METADATA_INVALID_PEER_SWITCH": {
"desc": "Verifying test fails with hostname that is too long",
"eStrKey": "Range"
},
"DEVICE_METADATA_VALID_STORAGE_DEVICE": {
"desc": "Verifying valid storage device value"
},
"DEVICE_METADATA_INVALID_STORAGE_DEVICE": {
"desc": "Verifying invalid storage device value",
"eStrKey": "InvalidValue"
}

}
7 changes: 7 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/port.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,12 @@
"desc": "PORT_INVALID_TPID_TEST invalid tpid value failure.",
"eStrKey" : "Pattern",
"eStr": ["0x8100|0x9100|0x9200|0x88a8|0x88A8"]
},
"PORT_VALID_MUX_CABLE_TEST": {
"desc": "PORT_VALID_MUX_CABLE_TEST no failure."
},
"PORT_INVALID_MUX_CABLE_TEST": {
"desc": "PORT_INVALID_MUX_CABLE_TEST non-boolean values, expect fail",
"eStrKey": "InvalidValue"
}
}
18 changes: 18 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/vlan.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,23 @@
},
"DHCPV6_SERVER_VALID_FORMAT": {
"desc": "Add dhcpv6_server in correct format."
},
"INVALID_VLAN_MAC": {
"desc": "VLAN with invalid MAC address",
"eStrKey": "Pattern"
},
"VLAN_INTERFACE_VALID_GRAT_ARP": {
"desc": "VLAN_INTERFACE with valid grat_arp value"
},
"VLAN_INTERFACE_VALID_PROXY_ARP": {
"desc": "VLAN_INTERFACE with valid proxy_arp value"
},
"VLAN_INTERFACE_INVALID_GRAT_ARP": {
"desc": "VLAN_INTERFACE with invalid grat_arp value",
"eStrKey": "Pattern"
},
"VLAN_INTERFACE_INVALID_PROXY_ARP": {
"desc": "VLAN_INTERFACE with invalid proxy_arp value",
"eStrKey": "Pattern"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"VLAN_SUB_INTERFACE_MUST_CONDITION_TRUE_TEST": {
"desc": "Configure valid vlan sub interface must condition true."
},
"VLAN_SUB_INTERFACE_MUST_CONDITION_FALSE_TEST": {
"desc": "Configure vlan sub interface must condition false.",
"eStrKey": "Must"
},
"VLAN_SUB_INTERFACE_IP_PREFIX_PORT_NON_EXISTING_LEAF_TEST": {
"desc": "Configure ip prefix vlan sub interface with non-existing reference.",
"eStrKey": "LeafRef"
},
"VLAN_SUB_INTERFACE_INVALID_VLAN_ID_TEST": {
"desc": "Configure vlan sub interface with invalid vlan id.",
"eStrKey": "Pattern"
},
"VLAN_SUB_INTERFACE_INVALID_VLAN_ID_WITH_LEADING_ZERO_TEST": {
"desc": "Configure vlan sub interface with invalid vlan id with leading zeros.",
"eStrKey": "Pattern"
},
"VLAN_SUB_INTERFACE_IP_PREFIX_EMPTY_STRING_TEST": {
"desc": "Configure ip prefix vlan sub interface with empty ip prefx.",
"eStrKey": "InvalidValue"
},
"VLAN_SUB_INTERFACE_INVALID_NAME_TEST": {
"desc": "Configure invalid vlan sub interface name with no separator.",
"eStrKey": "Pattern"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,59 @@
}
}
}
},
"DEVICE_METADATA_VALID_SUBTYPE": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"subtype": "DualToR"
}
}
}
},
"DEVICE_METADATA_INVALID_SUBTYPE": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"subtype": "FakeSubtype"
}
}
}
},
"DEVICE_METADATA_VALID_PEER_SWITCH": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"peer_switch": "peer_01_hostname"
}
}
}
},
"DEVICE_METADATA_INVALID_PEER_SWITCH": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"peer_switch": "this_super_duper_long_hostname_is_too_long_according_to_RFC_1035"
}
}
}
},
"DEVICE_METADATA_VALID_STORAGE_DEVICE": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"storage_device": "true"
}
}
}
},
"DEVICE_METADATA_INVALID_STORAGE_DEVICE": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"storage_device": "yes"
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,44 @@
]
}
}
},

"PORT_VALID_MUX_CABLE_TEST": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"name": "Ethernet8",
"alias": "eth8",
"lanes": "65",
"speed": 50000,
"mux_cable": "true"
},
{
"name": "Ethernet12",
"alias": "eth12",
"lanes": "6",
"speed": 50000,
"mux_cable": "false"
}
]
}
}
},

"PORT_INVALID_MUX_CABLE_TEST": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"name": "Ethernet8",
"alias": "eth8",
"lanes": "65",
"speed": 50000,
"mux_cable": "enabled"
}
]
}
}
}
}
Loading

0 comments on commit 5704bc9

Please sign in to comment.