Skip to content

[sonic-cfggen] Add support to generate sample t1 config#2039

Merged
lguohan merged 6 commits intosonic-net:masterfrom
taoyl-ms:taoyl/preset
Sep 16, 2018
Merged

[sonic-cfggen] Add support to generate sample t1 config#2039
lguohan merged 6 commits intosonic-net:masterfrom
taoyl-ms:taoyl/preset

Conversation

@taoyl-ms
Copy link
Contributor

- What I did
Add support in sonic-cfggen to generate a sample LeafRouter configuration json file for any SKU. This is a preparation to remove sample minigraphs from platform folders and to use auto-generated sample config json files instead.

- How to verify it
sonic-cfggen -H -k Mellanox-SN2700 --preset t1 will print a sample config_db.json file which is similar to the one generated from current default minigraph.

{
    "BGP_NEIGHBOR": {
        "10.0.0.1": {
            "rrclient": 0, 
            "name": "ARISTA01T2", 
            "local_addr": "10.0.0.0", 
            "nhopself": 0, 
            "holdtime": "180", 
            "asn": "65200", 
            "keepalive": "60"
        }, 
        "10.0.0.3": {
            "rrclient": 0, 
            "name": "ARISTA02T2", 
            "local_addr": "10.0.0.2", 
            "nhopself": 0, 
            "holdtime": "180", 
            "asn": "65200", 
            "keepalive": "60"
        }, 
        ...,
        "10.0.0.33": {
            "rrclient": 0, 
            "name": "ARISTA01T0", 
            "local_addr": "10.0.0.32", 
            "nhopself": 0, 
            "holdtime": "180", 
            "asn": "64001", 
            "keepalive": "60"
        }, 
        "10.0.0.35": {
            "rrclient": 0, 
            "name": "ARISTA02T0", 
            "local_addr": "10.0.0.34", 
            "nhopself": 0, 
            "holdtime": "180", 
            "asn": "64002", 
            "keepalive": "60"
        }, 
        ...
    }, 
    "DEVICE_METADATA": {
        "localhost": {
            "hwsku": "Mellanox-SN2700", 
            "platform": "x86_64-mlnx_msn2700-r0", 
            "mac": "7c:fe:90:5e:6a:80",
            "type": "LeafRouter", 
            "hostname": "sonic", 
            "bgp_asn": "65100"
        }
    }, 
    "DEVICE_NEIGHBOR": {}, 
    "LOOPBACK_INTERFACE": {
        "Loopback0|10.1.0.1/32": {}
    }, 
    "INTERFACE": {
        "Ethernet0|10.0.0.0/31": {}, 
        "Ethernet4|10.0.0.2/31": {}, 
        "Ethernet8|10.0.0.4/31": {}, 
        "Ethernet12|10.0.0.6/31": {}, 
        "Ethernet16|10.0.0.8/31": {}, 
        "Ethernet20|10.0.0.10/31": {}, 
        "Ethernet24|10.0.0.12/31": {}, 
        "Ethernet28|10.0.0.14/31": {}, 
        "Ethernet32|10.0.0.16/31": {}, 
        "Ethernet36|10.0.0.18/31": {}, 
        "Ethernet40|10.0.0.20/31": {}, 
        "Ethernet44|10.0.0.22/31": {}, 
        "Ethernet48|10.0.0.24/31": {}, 
        "Ethernet52|10.0.0.26/31": {}, 
        "Ethernet56|10.0.0.28/31": {}, 
        "Ethernet60|10.0.0.30/31": {}, 
        "Ethernet64|10.0.0.32/31": {}, 
        "Ethernet68|10.0.0.34/31": {}, 
        "Ethernet72|10.0.0.36/31": {}, 
        "Ethernet76|10.0.0.38/31": {}, 
        "Ethernet80|10.0.0.40/31": {}, 
        "Ethernet84|10.0.0.42/31": {}, 
        "Ethernet88|10.0.0.44/31": {}, 
        "Ethernet92|10.0.0.46/31": {}, 
        "Ethernet96|10.0.0.48/31": {}, 
        "Ethernet100|10.0.0.50/31": {}, 
        "Ethernet104|10.0.0.52/31": {}, 
        "Ethernet108|10.0.0.54/31": {}, 
        "Ethernet112|10.0.0.56/31": {}, 
        "Ethernet116|10.0.0.58/31": {}, 
        "Ethernet120|10.0.0.60/31": {}, 
        "Ethernet124|10.0.0.62/31": {}
    }, 
    "PORT": {
        "Ethernet0": {
            "alias": "Ethernet0", 
            "admin_status": "up", 
            "lanes": "0,1,2,3", 
            "mtu": "9100"
        }, 
        "Ethernet4": {
            "alias": "Ethernet4", 
            "admin_status": "up", 
            "lanes": "4,5,6,7", 
            "mtu": "9100"
        }, 
        "Ethernet8": {
            "alias": "Ethernet8", 
            "admin_status": "up", 
            "lanes": "8,9,10,11", 
            "mtu": "9100"
        }, 
        "Ethernet12": {
            "alias": "Ethernet12", 
            "admin_status": "up", 
            "lanes": "12,13,14,15", 
            "mtu": "9100"
        }, 
        ...
    }
}

@taoyl-ms taoyl-ms self-assigned this Sep 13, 2018
@taoyl-ms taoyl-ms requested a review from lguohan September 13, 2018 00:27
@stcheng
Copy link
Contributor

stcheng commented Sep 13, 2018

will there be any test cases to check the output?

Copy link
Collaborator

@lguohan lguohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add choices for preset option?

@taoyl-ms
Copy link
Contributor Author

Added. Now user will be able to see a list of preset templates in the -h message.

@lguohan lguohan merged commit ea28f3a into sonic-net:master Sep 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants