Hi,
Please let me know what is the API to delete a rule.
======================================================================================
>>> ipdb.rules
{RuleKey(action=1, table=253, priority=32767, iifname=0, oifname=0, fwmark=0, fwmask=0, goto=0, tun_id=0): {'family': 2, 'tos': 0, 'priority': 32767, 'flags': 0, 'action': 1, 'table': 253, 'ipdb_priority': 0, 'ipdb_scope': 'system'}, RuleKey(action=1, table=254, priority=32766, iifname=0, oifname=0, fwmark=0, fwmask=0, goto=0, tun_id=0): {'family': 2, 'tos': 0, 'priority': 32766, 'flags': 0, 'action': 1, 'table': 254, 'ipdb_priority': 0, 'ipdb_scope': 'system'}, RuleKey(action=1, table=255, priority=0, iifname=0, oifname=0, fwmark=0, fwmask=0, goto=0, tun_id=0): {'family': 2, 'tos': 0, 'flags': 0, 'action': 1, 'table': 255, 'ipdb_priority': 0, 'ipdb_scope': 'system'}}
========================================================================================
Adding a new rule
>>> ipdb.rules.add({ 'src': '
172.16.1.0/24', 'table': 123, 'priority':32765}).commit()
{'src': '
172.16.1.0/24', 'family': 2, 'tos': 0, 'priority': 32765, 'flags': 0, 'action': 1, 'table': 123, 'ipdb_priority': 0, 'ipdb_scope': 'system'}
>>>
Added successfully...
>>> ipdb.rules
{RuleKey(action=1, table=253, priority=32767, iifname=0, oifname=0, fwmark=0, fwmask=0, goto=0, tun_id=0): {'family': 2, 'tos': 0, 'priority': 32767, 'flags': 0, 'action': 1, 'table': 253, 'ipdb_priority': 0, 'ipdb_scope': 'system'}, RuleKey(action=1, table=123, priority=32765, iifname=0, oifname=0, fwmark=0, fwmask=0, goto=0, tun_id=0): {'src': '
172.16.1.0/24', 'family': 2, 'tos': 0, 'priority': 32765, 'flags': 0, 'action': 1, 'table': 123, 'ipdb_priority': 0, 'ipdb_scope': 'system'}, RuleKey(action=1, table=254, priority=32766, iifname=0, oifname=0, fwmark=0, fwmask=0, goto=0, tun_id=0): {'family': 2, 'tos': 0, 'priority': 32766, 'flags': 0, 'action': 1, 'table': 254, 'ipdb_priority': 0, 'ipdb_scope': 'system'}, RuleKey(action=1, table=255, priority=0, iifname=0, oifname=0, fwmark=0, fwmask=0, goto=0, tun_id=0): {'family': 2, 'tos': 0, 'flags': 0, 'action': 1, 'table': 255, 'ipdb_priority': 0, 'ipdb_scope': 'system'}}
=============================================================================================
Trying to delete the rule:
>>> ipdb.rules.pop({ 'src': '
172.16.1.0/24', 'table': 123, 'priority':32765}).commit()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'dict'
>>> ipdb.rules.pop({ 'src': '
172.16.1.0/24', 'table': 123, 'priority':32765})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'dict'
>>> ipdb.rules.clear({ 'src': '
172.16.1.0/24', 'table': 123, 'priority':32765}).commit()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: clear() takes no arguments (1 given)
==================================================================================================
Thanks,
Ragan.