Add tool to list moved globals
This tools list the constants and exceptions that have moved to neutron-lib. Add it to pep8 to raise awareness of moved globals. Related Blueprint: neutron-lib Change-Id: Ic6439f98d4bf8f566debf26eca3337f359119d5a
This commit is contained in:
parent
ab1b3f9bed
commit
961c5e73e9
@ -28,10 +28,6 @@ ROUTER_STATUS_ACTIVE = 'ACTIVE'
|
||||
# for agents to indicate when they are wiring up the ports. The following is
|
||||
# to indicate when the server is busy building sub-components of a router
|
||||
ROUTER_STATUS_ALLOCATING = 'ALLOCATING'
|
||||
L3_AGENT_MODE_DVR = 'dvr'
|
||||
L3_AGENT_MODE_DVR_SNAT = 'dvr_snat'
|
||||
L3_AGENT_MODE_LEGACY = 'legacy'
|
||||
L3_AGENT_MODE = 'agent_mode'
|
||||
|
||||
DEVICE_ID_RESERVED_DHCP_PORT = "reserved_dhcp_port"
|
||||
|
||||
@ -48,7 +44,6 @@ DEFAULT_MINIMUM_AGENTS_FOR_HA = 2
|
||||
HA_ROUTER_STATE_ACTIVE = 'active'
|
||||
HA_ROUTER_STATE_STANDBY = 'standby'
|
||||
|
||||
AGENT_TYPE_MACVTAP = 'Macvtap agent'
|
||||
PAGINATION_INFINITE = 'infinite'
|
||||
|
||||
SORT_DIRECTION_ASC = 'asc'
|
||||
@ -68,11 +63,6 @@ VALID_DSCP_MARKS = [0, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34,
|
||||
IP_PROTOCOL_NUM_TO_NAME_MAP = {
|
||||
str(v): k for k, v in lib_constants.IP_PROTOCOL_MAP.items()}
|
||||
|
||||
DHCPV6_STATEFUL = 'dhcpv6-stateful'
|
||||
DHCPV6_STATELESS = 'dhcpv6-stateless'
|
||||
IPV6_SLAAC = 'slaac'
|
||||
IPV6_MODES = [DHCPV6_STATEFUL, DHCPV6_STATELESS, IPV6_SLAAC]
|
||||
|
||||
# Special provisional prefix for IPv6 Prefix Delegation
|
||||
PROVISIONAL_IPV6_PD_PREFIX = '::/64'
|
||||
|
||||
|
49
tools/list_moved_globals.py
Executable file
49
tools/list_moved_globals.py
Executable file
@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# 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.
|
||||
|
||||
"""
|
||||
Check for globals that are now available in neutron-lib
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from neutron_lib import constants as lconst
|
||||
from neutron_lib import exceptions as lexc
|
||||
|
||||
from neutron.common import constants as nconst
|
||||
from neutron.common import exceptions as nexc
|
||||
|
||||
|
||||
def check_globals(things, nmod, lmod):
|
||||
core = vars(nmod)['my_globals']
|
||||
lib = vars(lmod)
|
||||
moved_things = []
|
||||
for thing in core:
|
||||
if thing.startswith('__') or thing == '_':
|
||||
continue
|
||||
if thing in lib:
|
||||
moved_things.append(thing)
|
||||
if moved_things:
|
||||
print("\nThese %s have moved to neutron-lib:" % things)
|
||||
for moved_thing in sorted(moved_things):
|
||||
print(" %s" % moved_thing)
|
||||
|
||||
|
||||
def main():
|
||||
check_globals('constants', nconst, lconst)
|
||||
check_globals('exceptions', nexc, lexc)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in New Issue
Block a user