Skip to content

Commit

Permalink
Changing the DPB fixure to get breakout cfg table (sonic-net#17)
Browse files Browse the repository at this point in the history
Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
  • Loading branch information
samaity committed Dec 14, 2019
1 parent 823e426 commit 5c65925
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,3 +836,30 @@ def testlog(request, dvs):
dvs.runcmd("logger === start test %s ===" % request.node.name)
yield testlog
dvs.runcmd("logger === finish test %s ===" % request.node.name)

##################### DPB fixtures ###########################################

HWSKU="Force10-S6000"

@pytest.yield_fixture(scope="module")
def create_dpb_config_file(dvs):
cmd = "sonic-cfggen -p /usr/share/sonic/hwsku/platform.json -k {} --print-data > /tmp/ports.json".format(HWSKU)
dvs.runcmd(['sh', '-c', cmd])
cmd = "sonic-cfggen -j /etc/sonic/init_cfg.json -j /tmp/ports.json --print-data > /tmp/dpb_config_db.json"
dvs.runcmd(['sh', '-c', cmd])
cmd = "mv /etc/sonic/config_db.json /etc/sonic/config_db.json.bak"
dvs.runcmd(cmd)
cmd = "cp /tmp/dpb_config_db.json /etc/sonic/config_db.json"
dvs.runcmd(cmd)

@pytest.yield_fixture(scope="module")
def remove_dpb_config_file(dvs):
cmd = "mv /etc/sonic/config_db.json.bak /etc/sonic/config_db.json"
dvs.runcmd(cmd)

@pytest.yield_fixture(scope="module")
def dpb_setup_fixture(dvs):
create_dpb_config_file(dvs)
dvs.restart()
yield
remove_dpb_config_file(dvs)

0 comments on commit 5c65925

Please sign in to comment.