/opt/imh-python/lib/python3.9/site-packages/openstack/network/v2
NameSizeModeActions
__pycache__/-0755rm
address_scope.py14950644editdlrm
agent.py48830644editdlrm
auto_allocated_topology.py17410644editdlrm
availability_zone.py14490644editdlrm
extension.py12720644editdlrm
firewall_group.py23230644editdlrm
firewall_policy.py36750644editdlrm
firewall_rule.py28120644editdlrm
flavor.py20730644editdlrm
floating_ip.py37840644editdlrm
health_monitor.py26320644editdlrm
listener.py26150644editdlrm
load_balancer.py22800644editdlrm
metering_label.py14430644editdlrm
metering_label_rule.py18880644editdlrm
network.py55450644editdlrm
network_ip_availability.py18230644editdlrm
network_segment_range.py28730644editdlrm
pool.py36760644editdlrm
pool_member.py20950644editdlrm
port.py65940644editdlrm
port_forwarding.py17300644editdlrm
qos_bandwidth_limit_rule.py13260644editdlrm
qos_dscp_marking_rule.py10920644editdlrm
qos_minimum_bandwidth_rule.py12420644editdlrm
qos_policy.py20430644editdlrm
qos_rule_type.py11030644editdlrm
quota.py56100644editdlrm
rbac_policy.py14750644editdlrm
router.py72420644editdlrm
security_group.py20590644editdlrm
security_group_rule.py39000644editdlrm
segment.py18650644editdlrm
service_profile.py14670644editdlrm
service_provider.py12420644editdlrm
subnet.py37430644editdlrm
subnet_pool.py34090644editdlrm
trunk.py28100644editdlrm
vpn_service.py19170644editdlrm
_base.py12390644editdlrm
_proxy.py1913740644editdlrm
__init__.py00644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/openstack/network/v2/router.py (7242B)
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from openstack import exceptions from openstack.network.v2 import _base from openstack import resource from openstack import utils class Router(_base.NetworkResource, resource.TagMixin): resource_key = 'router' resources_key = 'routers' base_path = '/routers' # capabilities allow_create = True allow_fetch = True allow_commit = True allow_delete = True allow_list = True # NOTE: We don't support query on datetime, list or dict fields _query_mapping = resource.QueryParameters( 'description', 'flavor_id', 'name', 'status', is_admin_state_up='admin_state_up', is_distributed='distributed', is_ha='ha', project_id='tenant_id', **resource.TagMixin._tag_query_parameters ) # Properties #: Availability zone hints to use when scheduling the router. #: *Type: list of availability zone names* availability_zone_hints = resource.Body('availability_zone_hints', type=list) #: Availability zones for the router. #: *Type: list of availability zone names* availability_zones = resource.Body('availability_zones', type=list) #: Timestamp when the router was created. created_at = resource.Body('created_at') #: The router description. description = resource.Body('description') #: The ``network_id``, for the external gateway. *Type: dict* external_gateway_info = resource.Body('external_gateway_info', type=dict) #: The ID of the flavor. flavor_id = resource.Body('flavor_id') #: The administrative state of the router, which is up ``True`` #: or down ``False``. *Type: bool* is_admin_state_up = resource.Body('admin_state_up', type=bool) #: The distributed state of the router, which is distributed ``True`` #: or not ``False``. *Type: bool* is_distributed = resource.Body('distributed', type=bool) #: The highly-available state of the router, which is highly available #: ``True`` or not ``False``. *Type: bool* is_ha = resource.Body('ha', type=bool) #: The router name. name = resource.Body('name') #: The ID of the project this router is associated with. project_id = resource.Body('tenant_id') #: Revision number of the router. *Type: int* revision_number = resource.Body('revision', type=int) #: The extra routes configuration for the router. routes = resource.Body('routes', type=list) #: The router status. status = resource.Body('status') #: Timestamp when the router was created. updated_at = resource.Body('updated_at') def _put(self, session, url, body): resp = session.put(url, json=body) exceptions.raise_from_response(resp) return resp def add_interface(self, session, **body): """Add an internal interface to a logical router. :param session: The session to communicate through. :type session: :class:`~keystoneauth1.adapter.Adapter` :param dict body: The body requested to be updated on the router :returns: The body of the response as a dictionary. :raises: :class:`~openstack.exceptions.SDKException` on error. """ url = utils.urljoin(self.base_path, self.id, 'add_router_interface') resp = self._put(session, url, body) return resp.json() def remove_interface(self, session, **body): """Remove an internal interface from a logical router. :param session: The session to communicate through. :type session: :class:`~keystoneauth1.adapter.Adapter` :param dict body: The body requested to be updated on the router :returns: The body of the response as a dictionary. :raises: :class:`~openstack.exceptions.SDKException` on error. """ url = utils.urljoin(self.base_path, self.id, 'remove_router_interface') resp = self._put(session, url, body) return resp.json() def add_extra_routes(self, session, body): """Add extra routes to a logical router. :param session: The session to communicate through. :type session: :class:`~keystoneauth1.adapter.Adapter` :param dict body: The request body as documented in the api-ref. :returns: The response as a Router object with the added extra routes. :raises: :class:`~openstack.exceptions.SDKException` on error. """ url = utils.urljoin(self.base_path, self.id, 'add_extraroutes') resp = self._put(session, url, body) self._translate_response(resp) return self def remove_extra_routes(self, session, body): """Remove extra routes from a logical router. :param session: The session to communicate through. :type session: :class:`~keystoneauth1.adapter.Adapter` :param dict body: The request body as documented in the api-ref. :returns: The response as a Router object with the extra routes left. :raises: :class:`~openstack.exceptions.SDKException` on error. """ url = utils.urljoin(self.base_path, self.id, 'remove_extraroutes') resp = self._put(session, url, body) self._translate_response(resp) return self def add_gateway(self, session, **body): """Add an external gateway to a logical router. :param session: The session to communicate through. :type session: :class:`~keystoneauth1.adapter.Adapter` :param dict body: The body requested to be updated on the router :returns: The body of the response as a dictionary. """ url = utils.urljoin(self.base_path, self.id, 'add_gateway_router') resp = session.put(url, json=body) return resp.json() def remove_gateway(self, session, **body): """Remove an external gateway from a logical router. :param session: The session to communicate through. :type session: :class:`~keystoneauth1.adapter.Adapter` :param dict body: The body requested to be updated on the router :returns: The body of the response as a dictionary. """ url = utils.urljoin(self.base_path, self.id, 'remove_gateway_router') resp = session.put(url, json=body) return resp.json() class L3AgentRouter(Router): resource_key = 'router' resources_key = 'routers' base_path = '/agents/%(agent_id)s/l3-routers' resource_name = 'l3-router' # capabilities allow_create = False allow_retrieve = True allow_commit = False allow_delete = False allow_list = True # NOTE: No query parameter is supported