Direct Connect (DCAAS)¶
Virtual Gateway¶
Virtual gateways function as virtual routers, linking direct connections to VPCs. A virtual gateway is bound to the VPC that is directly connected to a cloud private line. You can use the virtual gateway to connect to the network segment of the VPC to be accessed, and then use the VPC peering connections to access multiple VPCs.
List Virtual Gateways¶
This interface is used to query all virtual gateways accessible to
the tenant submitting the request. The virtual gateways are filtered based on
the filtering condition.
VirtualGateway
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='devstack-admin')
sdk.register_otc_extensions(conn)
for gw in conn.dcaas.virtual_gateways():
print(gw)
Create Virtual Gateway¶
This interface is used to create a virtual gateway with parameters.
VirtualGateway
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"vpc_id": "vpc-uuid",
"local_ep_group_id": "local-ep-group-uuid"
}
vg = conn.dcaas.create_virtual_gateway(**attrs)
print(vg)
Get Virtual Gateway¶
This interface is used to get a virtual gateway by ID
or an instance of class.
VirtualGateway
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"virtual_gateway": "virtual-gateway-uuid",
}
vg = conn.dcaas.get_virtual_gateway(**attrs)
print(vg)
Find Virtual Gateway¶
This interface is used to find a virtual gateway by id or name.
VirtualGateway
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"name_or_id": "name-or-uuid",
}
vg = conn.dcaas.find_virtual_gateway(**attrs)
print(vg)
Update Virtual Gateway¶
This interface is used to update parameters of a virtual gateway by
id or an instance of class.
VirtualGateway
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"virtual_gateway": "virtual-gateway-uuid",
"name": "newname"
}
vg = conn.dcaas.update_virtual_gateway(**attrs)
print(vg)
Delete Virtual Gateway¶
This interface is used to delete a virtual gateway by ID
or an instance of class.
VirtualGateway
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
virtual_gateway_id = "virtual-gateway-uuid"
conn.dcaas.delete_virtual_gateway(virtual_gateway_id)
Connection¶
Connections are abstractions of network circuits between locations on the cloud and local data centers. We provide ports only. After creating a connection, you need to contact the carrier to perform offline construction and set up the physical line for you. Connections are dedicated channels for your local data centers to access VPCs on the cloud. Compared with the traditional public network, connections are more stable, reliable, and secure. They provide a maximum transmission rate of 10 Gbit/s.
List Connections¶
This interface is used to query all connections accessible to
the tenant submitting the request. The connection are filtered based on
the filtering condition.
Connection
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
for c in conn.dcaas.connections():
Create Connection¶
This interface is used to create a connection with parameters.
Connection
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"port_type": "10G",
"bandwidth": "50",
"location": "Biere",
"provider": "OTC"
}
Get Connection¶
This interface is used to get a connection by ID or an instance of class.
Connection
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"connection": "connection-uuid",
}
c = conn.dcaas.get_connection(**attrs)
print(c)
Find Connection¶
This interface is used to find a connection by id or name.
Connection
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"name_or_id": "name-or-uuid",
}
c = conn.dcaas.find_connection(**attrs)
print(c)
Update Connection¶
This interface is used to update parameters of a connection by id or an
instance of class.
Connection
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"connection": "connection-uuid",
"name": "new-name"
}
c = conn.dcaas.update_connection(**attrs)
print(c)
Delete Connection¶
This interface is used to delete a connection by ID or an instance of class.
Connection
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
connection_id = "connection-uuid"
conn.dcaas.delete_connection(connection_id)
Virtual Interface¶
Virtual interfaces associate user gateways with virtual gateways, enabling local data centers to access VPCs.
List Virtual Interfaces¶
This interface is used to query all virtual interfaces accessible to
the tenant submitting the request. The virtual interfaces are filtered based on
the filtering condition.
VirtualInterface
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
for vi in conn.dcaas.virtual_interfaces():
print(vi)
Create Virtual Interface¶
This interface is used to create a virtual interface with parameters.
VirtualInterface
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"direct_connect_id": "direct_connect_uuid",
"vgw_id": "virtual_gateway_uuid",
"type": "public",
"service_type": "vpc",
"vlan": 2556,
"bandwidth": 10,
Get Virtual Interface¶
This interface is used to get a virtual interface by ID
or an instance of class.
VirtualInterface
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"virtual_interface": "virtual_interface_uuid",
}
vi = conn.dcaas.get_virtual_interface(**attrs)
print(vi)
Find Virtual Interface¶
This interface is used to find a virtual interface by id or name.
VirtualInterface
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"name_or_id": "name_or_uuid",
}
vi = conn.dcaas.find_virtual_interface(**attrs)
print(vi)
Update Virtual Interface¶
This interface is used to update parameters of a virtual interface by
id or an instance of class.
VirtualInterface
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"virtual_interface": "virtual_interface_uuid",
"name": "newname"
}
vi = conn.dcaas.update_virtual_interface(**attrs)
print(vi)
Delete Virtual Interface¶
This interface is used to delete a virtual interface by ID
or an instance of class.
VirtualInterface
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
virtual_interface_id = "virtual_interface_uuid"
conn.dcaas.delete_virtual_interface(virtual_interface_id)
Endpoint Group¶
List Endpoint Groups¶
This interface is used to query the Direct Connect Endpoint Group list and to filter the output with query parameters.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
for c in conn.dcaas.endpoint_groups():
print(c)
Create Endpoint Group¶
This interface is used to create Direct Connect Endpoint Group with parameters.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"name": "endpoint group1",
"description": "test description",
"endpoints": ["10.2.0.0/24", "10.3.0.0/24"],
"tenant_id": "tenant_uuid",
"type": "cidr"
}
c = conn.dcaas.create_endpoint_group(**attrs)
print(c)
Get Endpoint Group¶
This interface is used to get a DCAAS Endpoint Group by ID
or an instance of class
DirectConnectEndpointGroup
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"endpoint_group": "endpoint_group-uuid",
}
c = conn.dcaas.get_endpoint_group(**attrs)
print(c)
Find Endpoint Group¶
This interface is used to find a Direct Connect Endpoint Group by name or ID.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"name_or_id": "name-or-uuid",
}
c = conn.dcaas.find_endpoint_group(**attrs)
print(c)
Update Endpoint Group¶
This interface is used to update a Direct Connect Endpoint Group by ID
or an instance of class
DirectConnectEndpointGroup
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
attrs = {
"endpoint_group": "endpoint_group-uuid",
"name": "new-name"
}
c = conn.dcaas.update_endpoint_group(**attrs)
print(c)
Delete Endpoint Group¶
This interface is used to delete a Direct Connect Endpoint Group by ID
or an instance of class
DirectConnectEndpointGroup
.
import openstack
from otcextensions import sdk
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)
endpoint_group_id = "endpoint_group-uuid"
conn.dcaas.delete_endpoint_group(endpoint_group_id)