Ejemplo n.º 1
0
def parse(args):
    cfg.CONF(args=args, project="neutron", version="%%prog %s" % neutron_version.release_string())

    # Validate that the base_mac is of the correct format
    msg = attributes._validate_regex(cfg.CONF.base_mac, attributes.MAC_PATTERN)
    if msg:
        msg = _("Base MAC: %s") % msg
        raise Exception(msg)
Ejemplo n.º 2
0
def parse(args):
    cfg.CONF(args=args,
             project='neutron',
             version='%%prog %s' % neutron_version.release_string())

    # Validate that the base_mac is of the correct format
    msg = attributes._validate_regex(cfg.CONF.base_mac, attributes.MAC_PATTERN)
    if msg:
        msg = _("Base MAC: %s") % msg
        raise Exception(msg)
Ejemplo n.º 3
0
def parse(args):
    cfg.CONF(args=args, project='neutron',
             version='%%prog %s' % neutron_version.release_string())

    legacy.modernize_quantum_config(cfg.CONF)

    # Validate that the base_mac is of the correct format
    msg = attributes._validate_regex(cfg.CONF.base_mac,
                                     attributes.MAC_PATTERN)
    if msg:
        msg = _("Base MAC: %s") % msg
        raise Exception(msg)
Ejemplo n.º 4
0
#source_encoding = 'utf-8'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'Neutron'
copyright = u'2011-present, OpenStack Foundation.'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# Version info
from neutron.version import version_info as neutron_version
release = neutron_version.release_string()
# The short X.Y version.
version = neutron_version.version_string()

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of documents that shouldn't be included in the build.
# unused_docs = []
Ejemplo n.º 5
0
#source_encoding = 'utf-8'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'Neutron'
copyright = u'2011-present, OpenStack Foundation.'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# Version info
from neutron.version import version_info as neutron_version
release = neutron_version.release_string()
# The short X.Y version.
version = neutron_version.version_string()

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of documents that shouldn't be included in the build.
# unused_docs = []
Ejemplo n.º 6
0
HTTP_POST = "POST"
HTTP_DELETE = "DELETE"
HTTP_PUT = "PUT"
# Prefix to be used for all NVP API calls
URI_PREFIX = "/ws.v1"
# Resources exposed by NVP API
LSWITCH_RESOURCE = "lswitch"
LSWITCHPORT_RESOURCE = "lport/%s" % LSWITCH_RESOURCE
LROUTER_RESOURCE = "lrouter"
LROUTERPORT_RESOURCE = "lport/%s" % LROUTER_RESOURCE
LROUTERRIB_RESOURCE = "rib/%s" % LROUTER_RESOURCE
LROUTERNAT_RESOURCE = "nat/lrouter"
LQUEUE_RESOURCE = "lqueue"
GWSERVICE_RESOURCE = "gateway-service"
# Current neutron version
NEUTRON_VERSION = version_info.release_string()
# Other constants for NVP resource
MAX_DISPLAY_NAME_LEN = 40
# Constants for NAT rules
MATCH_KEYS = [
    "destination_ip_addresses",
    "destination_port_max",
    "destination_port_min",
    "source_ip_addresses",
    "source_port_max",
    "source_port_min",
    "protocol",
]

SNAT_KEYS = ["to_src_port_min", "to_src_port_max", "to_src_ip_min", "to_src_ip_max"]
Ejemplo n.º 7
0
#
#         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 neutron.api.v2.attributes import is_attr_set
from neutron.openstack.common import log
from neutron.version import version_info

LOG = log.getLogger(__name__)
MAX_DISPLAY_NAME_LEN = 40
NEUTRON_VERSION = version_info.release_string()


def get_tags(**kwargs):
    tags = ([dict(tag=value, scope=key) for key, value in kwargs.iteritems()])
    tags.append({"tag": NEUTRON_VERSION, "scope": "quantum"})
    return tags


def check_and_truncate(display_name):
    if is_attr_set(display_name) and len(display_name) > MAX_DISPLAY_NAME_LEN:
        LOG.debug(
            _("Specified name:'%s' exceeds maximum length. "
              "It will be truncated on NVP"), display_name)
        return display_name[:MAX_DISPLAY_NAME_LEN]
    return display_name or ''