Skip to content

Commit

Permalink
update CLI
Browse files Browse the repository at this point in the history
Signed-off-by: Kanji Nakano <[email protected]>
  • Loading branch information
nakano-omw committed Nov 9, 2023
1 parent 3584803 commit 1163b64
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions CLI/actioner/sonic-cli-feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,30 @@
import re


def invoke(func, enable):
def config_nhg_feature(enable):
body = None
aa = cc.ApiClient()

feature = "nexthop_group"

if enable == "1":

keypath = cc.Path("/restconf/data/sonic-feature:sonic-feature")

if enable:
keypath = cc.Path("/restconf/data/sonic-device_metadata:sonic-device_metadata")
body = {
"sonic-feature": {
"FEATURE": {"FEATURE_LIST": [{"name": feature, "state": "enabled"}]}
"sonic-device_metadata": {
"DEVICE_METADATA": {"localhost": {"nexthop_group": "enabled"}}
}
}
return aa.patch(keypath, body)

else:

keypath = cc.Path(
"/restconf/data/sonic-feature:sonic-feature/FEATURE/FEATURE_LIST={}".format(
feature
)
"/restconf/data/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/nexthop_group"
)

return aa.delete(keypath)


def invoke(func, enable):
if func == "configure_sonic_nexthop_groups":
return config_nhg_feature(enable == "1")


def run(func, enable):
if func != "configure_sonic_nexthop_groups":
print("%Error: Invalid function")
Expand Down

0 comments on commit 1163b64

Please sign in to comment.