Anti-DDoS (AS)

Floating-IP Operations

Floating IP operations lists all methods which are used to query and modify Floating IPs settings related to Anti-DDoS.

List Anti-DDoS Floating IPs

This interface is used to query all Floating IPs protected by Anti-DDoS and limit the output with parameters.

import openstack

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')


for fip in conn.anti_ddos.floating_ips():
    print(fip)

Protect an Floating IP (not working)

This interface is used to enable Anti-DDoS on a Floating IP by using IP id or an instance of class FloatingIP.

import openstack

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

fip = "floating_ip_id"
conn.anti_ddos.protect_floating_ip(fip)

Unprotect an Floating IP (not working)

This interface is used to disable Anti-DDoS on a Floating IP by using IP id or an instance of class FloatingIP.

import openstack

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

fip = "floating_ip_id"
conn.anti_ddos.unprotect_floating_ip(fip)

Get Floating IP Policies

This Interface is used to query the Anti-DDoS Policy for a specific Floating IP by using Floating IP id or an instance of class FloatingIP. Anti-DDoS must be enabled for the specific Floating IP otherwise an error occures.

import openstack

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

fip = "floating_ip_id"
policy = conn.anti_ddos.get_floating_ip_policies(fip)
print(policy)

Update Floating IP Policies

This Interface is used to update Anti-DDoS Policy attributes.

import openstack

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

fip = "floating_ip_id"
attrs = {
    "enable_L7": False,
    "traffic_pos_id": 2,
    "http_request_pos_id": 1,
    "cleaning_access_pos_id": 1,
    "app_type_id": 1
}

policy = conn.anti_ddos.update_floating_ip_policies(fip, **attrs)

Get Floating IP Status

This Interface is used to query Anti-DDoS status of a Floating IP by using id.

import openstack

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')


fip = "floating_ip_id"

status = conn.anti_ddos.get_floating_ip_status(fip)
print(status)

List Floating IP Events

This Interface is used to query all Anti-DDoS events of a Floating IP by using id.

import openstack

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')


fip = "floating_ip_id"

for event in conn.anti_ddos.floating_ip_events(fip):
    print(event)

List Floating IP Day Statistics

This Interface is used to query all Anti-DDoS events per day of a Floating IP by using id.

import openstack

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')


fip = "floating_ip_id"

for event in conn.anti_ddos.floating_ip_stat_day(fip):
    print(event)

List Week Statistics of all Floating IPs

This Interface is used to query all Anti-DDoS events per week of all Floating IPs.

import openstack

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')


for event in conn.anti_ddos.floating_ip_stat_week():
    print(event)

Alarm Configuration

Anti-DDoS alerts can be sent in various ways and notifies in case of defense.

List Alarm Configurations

This Interface is used to query Anti-DDoS alarm configurations.

import openstack

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')


for config in conn.anti_ddos.configs():
    print(config)