@abstractmethod
def create_subnet(self, context, subnet):
- """
+ """Create a subnet.
+
Create a subnet, which represents a range of IP addresses
that can be allocated to devices
: param context: quantum api request context
@abstractmethod
def update_subnet(self, context, id, subnet):
- """
- Update values of a subnet.
+ """Update values of a subnet.
+
: param context: quantum api request context
: param id: UUID representing the subnet to update.
: param subnet: dictionary with keys indicating fields to update.
@abstractmethod
def get_subnet(self, context, id, fields=None):
- """
- Retrieve a subnet.
+ """Retrieve a subnet.
+
: param context: quantum api request context
: param id: UUID representing the subnet to fetch.
: param fields: a list of strings that are valid keys in a
@abstractmethod
def get_subnets(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None, page_reverse=False):
- """
- Retrieve a list of subnets. The contents of the list depends on
+ """Retrieve a list of subnets.
+
+ The contents of the list depends on
the identity of the user making the request (as indicated by the
context) as well as any filters.
: param context: quantum api request context
pass
def get_subnets_count(self, context, filters=None):
- """
- Return the number of subnets. The result depends on the identity of
+ """Return the number of subnets.
+
+ The result depends on the identity of
the user making the request (as indicated by the context) as well as
any filters.
: param context: quantum api request context
@abstractmethod
def delete_subnet(self, context, id):
- """
- Delete a subnet.
+ """Delete a subnet.
+
: param context: quantum api request context
: param id: UUID representing the subnet to delete.
"""
@abstractmethod
def create_network(self, context, network):
- """
+ """Create a network.
+
Create a network, which represents an L2 network segment which
can have a set of subnets and ports associated with it.
: param context: quantum api request context
@abstractmethod
def update_network(self, context, id, network):
- """
- Update values of a network.
+ """Update values of a network.
+
: param context: quantum api request context
: param id: UUID representing the network to update.
: param network: dictionary with keys indicating fields to update.
@abstractmethod
def get_network(self, context, id, fields=None):
- """
- Retrieve a network.
+ """Retrieve a network.
+
: param context: quantum api request context
: param id: UUID representing the network to fetch.
: param fields: a list of strings that are valid keys in a
@abstractmethod
def get_networks(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None, page_reverse=False):
- """
- Retrieve a list of networks. The contents of the list depends on
+ """Retrieve a list of networks.
+
+ The contents of the list depends on
the identity of the user making the request (as indicated by the
context) as well as any filters.
: param context: quantum api request context
pass
def get_networks_count(self, context, filters=None):
- """
- Return the number of networks. The result depends on the identity
+ """Return the number of networks.
+
+ The result depends on the identity
of the user making the request (as indicated by the context) as well
as any filters.
: param context: quantum api request context
@abstractmethod
def delete_network(self, context, id):
- """
- Delete a network.
+ """Delete a network.
+
: param context: quantum api request context
: param id: UUID representing the network to delete.
"""
@abstractmethod
def create_port(self, context, port):
- """
+ """Create a port.
+
Create a port, which is a connection point of a device (e.g., a VM
NIC) to attach to a L2 Quantum network.
: param context: quantum api request context
@abstractmethod
def update_port(self, context, id, port):
- """
- Update values of a port.
+ """Update values of a port.
+
: param context: quantum api request context
: param id: UUID representing the port to update.
: param port: dictionary with keys indicating fields to update.
@abstractmethod
def get_port(self, context, id, fields=None):
- """
- Retrieve a port.
+ """Retrieve a port.
+
: param context: quantum api request context
: param id: UUID representing the port to fetch.
: param fields: a list of strings that are valid keys in a
@abstractmethod
def get_ports(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None, page_reverse=False):
- """
- Retrieve a list of ports. The contents of the list depends on
- the identity of the user making the request (as indicated by the
- context) as well as any filters.
+ """Retrieve a list of ports.
+
+ The contents of the list depends on the identity of the user making
+ the request (as indicated by the context) as well as any filters.
: param context: quantum api request context
: param filters: a dictionary with keys that are valid keys for
a port as listed in the RESOURCE_ATTRIBUTE_MAP object
pass
def get_ports_count(self, context, filters=None):
- """
- Return the number of ports. The result depends on the identity of
- the user making the request (as indicated by the context) as well as
- any filters.
+ """Return the number of ports.
+
+ The result depends on the identity of the user making the request
+ (as indicated by the context) as well as any filters.
: param context: quantum api request context
: param filters: a dictionary with keys that are valid keys for
a network as listed in the RESOURCE_ATTRIBUTE_MAP object
@abstractmethod
def delete_port(self, context, id):
- """
- Delete a port.
+ """Delete a port.
+
: param context: quantum api request context
: param id: UUID representing the port to delete.
"""
class Middleware(object):
- """
- Base WSGI middleware wrapper. These classes require an application to be
- initialized that will be called next. By default the middleware will
- simply call its wrapped app, or you can override __call__ to customize its
- behavior.
+ """Base WSGI middleware wrapper.
+
+ These classes require an application to be initialized that will be called
+ next. By default the middleware will simply call its wrapped app, or you
+ can override __call__ to customize its behavior.
"""
@classmethod
self.application = application
def process_request(self, req):
- """
- Called on each request.
+ """Called on each request.
If this returns None, the next application down the stack will be
executed. If it returns a response then that response will be returned
class XMLDictSerializer(DictSerializer):
def __init__(self, metadata=None, xmlns=None):
- """
+ """Object initialization.
+
:param metadata: information needed to deserialize xml into
a dictionary.
:param xmlns: XML namespace to include with serialized xml
self.xmlns = xmlns
def default(self, data):
- """
+ """Return data as XML string.
+
:param data: expect data to contain a single key as XML root, or
contain another '*_links' key as atom links. Other
case will use 'VIRTUAL_ROOT_KEY' as XML root.
class XMLDeserializer(TextDeserializer):
def __init__(self, metadata=None):
- """
+ """Object initialization.
+
:param metadata: information needed to deserialize xml into
a dictionary.
"""
class Debug(Middleware):
- """
+ """Middleware for debugging.
+
Helper class that can be inserted into any WSGI application chain
to get information about the request and response.
"""
@staticmethod
def print_generator(app_iter):
- """
- Iterator that prints the contents of a wrapper string iterator
- when iterated.
- """
+ """Print contents of a wrapper string iterator when iterated."""
print ("*" * 40) + " BODY"
for part in app_iter:
sys.stdout.write(part)
class Router(object):
- """
- WSGI middleware that maps incoming requests to WSGI apps.
- """
+ """WSGI middleware that maps incoming requests to WSGI apps."""
@classmethod
def factory(cls, global_config, **local_config):
- """
- Returns an instance of the WSGI Router class
- """
+ """Return an instance of the WSGI Router class."""
return cls()
def __init__(self, mapper):
- """
- Create a router for the given routes.Mapper.
+ """Create a router for the given routes.Mapper.
Each route in `mapper` must specify a 'controller', which is a
WSGI app to call. You'll probably want to specify an 'action' as
@webob.dec.wsgify
def __call__(self, req):
- """
- Route the incoming request to a controller based on self.map.
+ """Route the incoming request to a controller based on self.map.
+
If no match, return a 404.
"""
return self._router
@staticmethod
@webob.dec.wsgify
def _dispatch(req):
- """
+ """Dispatch a Request.
+
Called by self._router after matching the incoming request to a route
- and putting the information into req.environ. Either returns 404
+ and putting the information into req.environ. Either returns 404
or the routed WSGI app's response.
"""
match = req.environ['wsgiorg.routing_args'][1]
def __init__(self, controller, fault_body_function,
deserializer=None, serializer=None):
- """
+ """Object initialization.
+
:param controller: object that implement methods created by routes lib
:param deserializer: object that can serialize the output of a
controller into a webob response
@webob.dec.wsgify(RequestClass=Request)
def __call__(self, req):
- """
- Call the method specified in req.environ by RoutesMiddleware.
- """
+ """Call the method specified in req.environ by RoutesMiddleware."""
arg_dict = req.environ['wsgiorg.routing_args'][1]
action = arg_dict['action']
method = getattr(self, action)