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

Add the hostname field,When device/default_sku is set to l2 #17701

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/sonic-config-engine/config_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def generate_l1_config(data):
def generate_l3_config(data):
data['LOOPBACK_INTERFACE'] = {"Loopback0": {},
"Loopback0|10.1.0.1/32": {}}
data['DEVICE_METADATA']['localhost']['hostname'] = 'sonic'
data['BGP_NEIGHBOR'] = {}
data['DEVICE_NEIGHBOR'] = {}
data['INTERFACE'] = {}
Expand Down Expand Up @@ -144,6 +145,7 @@ def generate_global_dualtor_tables():
return data

def generate_l2_config(data):
data['DEVICE_METADATA']['localhost']['hostname'] = 'sonic'
# Check if dual ToR configs are needed
if 'is_dualtor' in data and data['is_dualtor']:
is_dualtor = True
Expand Down
7 changes: 6 additions & 1 deletion src/sonic-config-engine/data/l2switch.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"DEVICE_METADATA": {{ DEVICE_METADATA | tojson }},
"DEVICE_METADATA": {
"localhost" : {
"hostname": "sonic",
"hwsku" : "{{ DEVICE_METADATA.localhost.hwsku }}"
}
},
"FLEX_COUNTER_TABLE": {
"ACL": {
"FLEX_COUNTER_STATUS": "disable",
Expand Down
1 change: 1 addition & 0 deletions src/sonic-config-engine/data/l3intf.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"DEVICE_METADATA": {
"localhost" : {
"hostname": "sonic",
"hwsku" : "{{ DEVICE_METADATA.localhost.hwsku }}"
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"DEVICE_METADATA": {"localhost": {"hwsku": "Mellanox-SN2700"}},
"DEVICE_METADATA": {
"localhost": {
"hostname": "sonic",
"hwsku": "Mellanox-SN2700"
}
},
"PORT": {
"Ethernet8": {
"alias": "fortyGigE0/8",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"hostname": "sonic",
"hwsku": "Arista-7050CX3-32S-D48C8",
"subtype": "DualToR",
"peer_switch": "peer_switch_hostname"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"DEVICE_METADATA": {"localhost": {"hwsku": "32x1000Gb"}},
"DEVICE_METADATA": {
"localhost": {
"hostname": "sonic",
"hwsku": "32x1000Gb"
}
},
"PORT": {
"Ethernet0": {
"admin_status": "up",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"DEVICE_METADATA": {"localhost": {"hwsku": "Mellanox-SN2700"}},
"DEVICE_METADATA": {
"localhost": {
"hostname": "sonic",
"hwsku": "Mellanox-SN2700"
}
},
"PORT": {
"Ethernet0": {
"alias": "fortyGigE0/0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"hostname": "sonic",
"hwsku": "Arista-7050CX3-32S-D48C8",
"subtype": "DualToR",
"peer_switch": "peer_switch_hostname"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"DEVICE_METADATA": {"localhost": {"hwsku": "32x1000Gb"}},
"DEVICE_METADATA": {
"localhost": {
"hostname": "sonic",
"hwsku": "32x1000Gb"
}
},
"PORT": {
"Ethernet0": {
"admin_status": "up",
Expand Down
Loading