def del_addr_set_api(self, addr_set_group, ip): address_object = self._addr_set_cache_del(addr_set_group, ip) if not address_object: LOG.debug(_('addr_set element has been deleted, no address set found : ' 'address_set %s'), addr_set_group) return True bodyinfo = ngfw_utils.get_addr_set(address_object) LOG.debug(_('delete address_set ,xml body is: %s' % bodyinfo)) response = self.rest.rest_api('DELETE', ngfw_utils.NGFW_URL_ADDR_SET, bodyinfo) if response['status'] > 400: LOG.error(_('delete address_set failed.')) return False LOG.debug(_('delete address_set success.')) self.addr_set_cache_flush(address_object, 'delete') return True
def update_addr_set_api(self, addr_set_group, ip): address_object = self._addr_set_cache_update(addr_set_group, ip) if not address_object: LOG.error(_('address set cache update error, no address set found : ' 'address_set %s'), addr_set_group) return False bodyinfo = ngfw_utils.get_addr_set(address_object) LOG.debug(_('update address_set ,xml body is: %s' % bodyinfo)) response = self.rest.rest_api('PUT', ngfw_utils.NGFW_URL_ADDR_SET, bodyinfo) if response['status'] >= 400: LOG.error(_('update address_set failed.')) return False LOG.debug(_('update address_set success.')) self.addr_set_cache_flush(address_object, 'update') return True
def del_addr_set_api(self, addr_set_group, ip): address_object = self._addr_set_cache_del(addr_set_group, ip) if not address_object: LOG.debug( _('addr_set element has been deleted, no address set found : ' 'address_set %s'), addr_set_group) return True bodyinfo = ngfw_utils.get_addr_set(address_object) LOG.debug(_('delete address_set ,xml body is: %s' % bodyinfo)) response = self.rest.rest_api('DELETE', ngfw_utils.NGFW_URL_ADDR_SET, bodyinfo) if response['status'] > 400: LOG.error(_('delete address_set failed.')) return False LOG.debug(_('delete address_set success.')) self.addr_set_cache_flush(address_object, 'delete') return True
def update_addr_set_api(self, addr_set_group, ip): address_object = self._addr_set_cache_update(addr_set_group, ip) if not address_object: LOG.error( _('address set cache update error, no address set found : ' 'address_set %s'), addr_set_group) return False bodyinfo = ngfw_utils.get_addr_set(address_object) LOG.debug(_('update address_set ,xml body is: %s' % bodyinfo)) response = self.rest.rest_api('PUT', ngfw_utils.NGFW_URL_ADDR_SET, bodyinfo) if response['status'] >= 400: LOG.error(_('update address_set failed.')) return False LOG.debug(_('update address_set success.')) self.addr_set_cache_flush(address_object, 'update') return True