Add consts for OVN install path

As suggested in https://review.opendev.org/#/c/686432/ this
patch adds the following constants to ovsdbapp, so it can
be referred by other repos, such as networking-ovn:

- OVS_INSTALL_SHARE_PATH
- OVN_INSTALL_SHARE_PATH

Change-Id: I287ee1ca7cc68d9e5ec0acc8ab77371d89933e2e
This commit is contained in:
Flavio Fernandes 2019-10-29 15:02:05 -04:00
parent 4a42196852
commit e4c55ddc12
2 changed files with 11 additions and 2 deletions

View File

@ -12,6 +12,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import os
DEFAULT_OVSDB_CONNECTION = 'tcp:127.0.0.1:6640' DEFAULT_OVSDB_CONNECTION = 'tcp:127.0.0.1:6640'
DEFAULT_OVNNB_CONNECTION = 'tcp:127.0.0.1:6641' DEFAULT_OVNNB_CONNECTION = 'tcp:127.0.0.1:6641'
DEFAULT_TIMEOUT = 5 DEFAULT_TIMEOUT = 5
@ -29,3 +32,8 @@ NAT_TYPES = (NAT_SNAT, NAT_DNAT, NAT_BOTH)
PROTO_TCP = 'tcp' PROTO_TCP = 'tcp'
PROTO_UDP = 'udp' PROTO_UDP = 'udp'
OVS_INSTALL_SHARE_PATH = os.path.join(os.path.sep, 'usr', 'local', 'share',
'openvswitch')
OVN_INSTALL_SHARE_PATH = os.path.join(os.path.sep, 'usr', 'local', 'share',
'ovn')

View File

@ -18,6 +18,7 @@ import subprocess
import time import time
import fixtures import fixtures
from ovsdbapp import constants as const
# These are the valid dummy values for ovs-vswitchd process. They are here just # These are the valid dummy values for ovs-vswitchd process. They are here just
# to get user enumeration. See man ovs-vswitchd(8) for more information. # to get user enumeration. See man ovs-vswitchd(8) for more information.
@ -48,7 +49,7 @@ class OvsVenvFixture(fixtures.Fixture):
":%s" % os.getenv('PATH')) ":%s" % os.getenv('PATH'))
else: else:
self.env['PATH'] = os.getenv('PATH') self.env['PATH'] = os.getenv('PATH')
self.ovsdir = os.path.join('/usr', 'local', 'share', 'openvswitch') self.ovsdir = const.OVS_INSTALL_SHARE_PATH
if not os.path.isdir(self.ovsdir): if not os.path.isdir(self.ovsdir):
self.ovsdir = os.path.join('/usr', 'share', 'openvswitch') self.ovsdir = os.path.join('/usr', 'share', 'openvswitch')
if not os.path.isdir(self.ovsdir): if not os.path.isdir(self.ovsdir):
@ -133,7 +134,7 @@ class OvsOvnVenvFixture(OvsVenvFixture):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.add_chassis = kwargs.pop('add_chassis', False) self.add_chassis = kwargs.pop('add_chassis', False)
self.ovndir = kwargs.pop('ovndir') or '/usr/local/share/ovn' self.ovndir = kwargs.pop('ovndir') or const.OVN_INSTALL_SHARE_PATH
self.PATH_VAR_TEMPLATE += ( self.PATH_VAR_TEMPLATE += (
":{0}/controller:{0}/northd:{0}/utilities".format( ":{0}/controller:{0}/northd:{0}/utilities".format(
self.ovndir)) self.ovndir))