¡@

Home 

OpenStack Study: sdnve_api_fake.py

OpenStack Index

**** CubicPower OpenStack Study ****

# Copyright 2014 IBM Corp.

#

# All Rights Reserved.

#

# 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.

#

# @author: Mohammad Banikazemi, IBM Corp.

from neutron.openstack.common import log as logging

from neutron.plugins.ibm.common import constants

LOG = logging.getLogger(__name__)

HTTP_OK = 200

**** CubicPower OpenStack Study ****

class FakeClient():

'''Fake Client for SDNVE controller.'''

**** CubicPower OpenStack Study ****

    def __init__(self, **kwargs):

        LOG.info(_('Fake SDNVE controller initialized'))

**** CubicPower OpenStack Study ****

    def sdnve_list(self, resource, **_params):

        LOG.info(_('Fake SDNVE controller: list'))

        return (HTTP_OK, None)

**** CubicPower OpenStack Study ****

    def sdnve_show(self, resource, specific, **_params):

        LOG.info(_('Fake SDNVE controller: show'))

        return (HTTP_OK, None)

**** CubicPower OpenStack Study ****

    def sdnve_create(self, resource, body):

        LOG.info(_('Fake SDNVE controller: create'))

        return (HTTP_OK, None)

**** CubicPower OpenStack Study ****

    def sdnve_update(self, resource, specific, body=None):

        LOG.info(_('Fake SDNVE controller: update'))

        return (HTTP_OK, None)

**** CubicPower OpenStack Study ****

    def sdnve_delete(self, resource, specific):

        LOG.info(_('Fake SDNVE controller: delete'))

        return (HTTP_OK, None)

**** CubicPower OpenStack Study ****

    def sdnve_get_tenant_byid(self, id):

        LOG.info(_('Fake SDNVE controller: get tenant by id'))

        return id, constants.TENANT_TYPE_OF

**** CubicPower OpenStack Study ****

    def sdnve_check_and_create_tenant(self, id, network_type=None):

        LOG.info(_('Fake SDNVE controller: check and create tenant'))

        return id

**** CubicPower OpenStack Study ****

    def sdnve_get_controller(self):

        LOG.info(_('Fake SDNVE controller: get controller'))

        return None