From cb8538962815ea82665a4d4b851d50ea0793811d Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 8 Dec 2017 11:01:53 -0800 Subject: [PATCH] Adapt to py-swsssdk refactor of mod_entry and mod_config (#165) --- acl_loader/main.py | 12 ++++++------ config/main.py | 2 +- pfcwd/main.py | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/acl_loader/main.py b/acl_loader/main.py index dbe61e3276..e1b14f1bba 100644 --- a/acl_loader/main.py +++ b/acl_loader/main.py @@ -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): """ @@ -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): """ diff --git a/config/main.py b/config/main.py index 7572513a4e..854f84c91a 100755 --- a/config/main.py +++ b/config/main.py @@ -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 diff --git a/pfcwd/main.py b/pfcwd/main.py index 288b10e0ad..764ff25288 100644 --- a/pfcwd/main.py +++ b/pfcwd/main.py @@ -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() @@ -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()