Jakub Libosvar 1902d71c50 Consolidate use of IP_VERSION_TO_FAMILY conversion
The constant mapping has been defined in several places. This patch
creates a new module utils.common that defines the mapping and uses it
everywhere. It also encapsulates socket family constants in the
constants module and reuses the constants.

Change-Id: I754d4c06007db7d68ceaa64e76f3ef2305d7850c
2024-01-12 16:33:39 +00:00

18 lines
683 B
Python

# Copyright 2024 Red Hat, Inc.
#
# 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.
from ovn_bgp_agent import constants
IP_VERSION_FAMILY_MAP = {4: constants.AF_INET, 6: constants.AF_INET6}