def delete_entries(self, rules, namespace): rule_filters = (self._get_filter_from_rule(r) for r in rules) rule_filters = sorted(rule_filters) entries = nl_lib.list_entries(namespace) delete_entries = self._get_entries_to_delete(rule_filters, entries) if delete_entries: nl_lib.delete_entries(delete_entries, namespace)
def _delete_entry(self, delete_entries, remain_entries): namespace = self.useFixture(net_helpers.NamespaceFixture()).name self._create_entries(namespace, CONNTRACK_CMDS) nl_lib.delete_entries(namespace=namespace, entries=delete_entries) entries_list = nl_lib.list_entries(namespace) self.assertEqual(remain_entries, entries_list)
def _delete_entry(self, delete_entries, remain_entries): namespace = self.useFixture(net_helpers.NamespaceFixture()).name _create_entries(namespace, self.CONNTRACK_CMDS) nl_lib.delete_entries(namespace=namespace, entries=delete_entries) entries_list = nl_lib.list_entries(namespace) self.assertEqual(remain_entries, entries_list)