Skip to content

Adapt to py-swsssdk refactor of mod_entry and mod_config #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()