Skip to content

Commit

Permalink
Adapt to py-swsssdk refactor of mod_entry and mod_config (sonic-net#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
taoyl-ms authored Dec 8, 2017
1 parent 1c680b4 commit cb85389
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions acl_loader/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ def full_update(self):
:return:
"""
for key in self.rules_db_info.keys():
self.configdb.set_entry(self.ACL_RULE, key, None)
self.configdb.mod_entry(self.ACL_RULE, key, None)

self.configdb.set_config({self.ACL_RULE: self.rules_info})
self.configdb.mod_config({self.ACL_RULE: self.rules_info})

def incremental_update(self):
"""
Expand All @@ -359,15 +359,15 @@ def incremental_update(self):
existing_rules = new_rules.intersection(current_rules)

for key in removed_rules:
self.configdb.set_entry(self.ACL_RULE, key, None)
self.configdb.mod_entry(self.ACL_RULE, key, None)

for key in added_rules:
self.configdb.set_entry(self.ACL_RULE, key, self.rules_info[key])
self.configdb.mod_entry(self.ACL_RULE, key, self.rules_info[key])

for key in existing_rules:
if cmp(self.rules_info[key], self.rules_db_info[key]):
self.configdb.set_entry(self.ACL_RULE, key, None)
self.configdb.set_entry(self.ACL_RULE, key, self.rules_info[key])
self.configdb.mod_entry(self.ACL_RULE, key, None)
self.configdb.mod_entry(self.ACL_RULE, key, self.rules_info[key])

def show_table(self, table_name):
"""
Expand Down
2 changes: 1 addition & 1 deletion config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _switch_bgp_session_status_by_addr(ipaddress, status, verbose):
click.echo("{} {} BGP session with neighbor {}...".format(verb, status, ipaddress))
config_db = ConfigDBConnector()
config_db.connect()
config_db.set_entry('bgp_neighbor', ipaddress, {'admin_status': status})
config_db.mod_entry('bgp_neighbor', ipaddress, {'admin_status': status})

def _switch_bgp_session_status(ipaddr_or_hostname, status, verbose):
"""Start up or shut down BGP session by IP address or hostname
Expand Down
6 changes: 3 additions & 3 deletions pfcwd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def start(action, restoration_time, ports, detection_time):
for port in ports:
if port not in all_ports:
continue
configdb.set_entry("PFC_WD_TABLE", port, None)
configdb.set_entry("PFC_WD_TABLE", port, pfcwd_info)
configdb.mod_entry("PFC_WD_TABLE", port, None)
configdb.mod_entry("PFC_WD_TABLE", port, pfcwd_info)

# Stop WD
@cli.command()
Expand All @@ -148,7 +148,7 @@ def stop(ports):
for port in ports:
if port not in all_ports:
continue
configdb.set_entry("PFC_WD_TABLE", port, None)
configdb.mod_entry("PFC_WD_TABLE", port, None)

if __name__ == '__main__':
cli()

0 comments on commit cb85389

Please sign in to comment.