[sonic-config-engine] Clean up dependencies, pin versions; install Python 3 package in Buster container (#5656)
To clean up the image build procedure, and let setuptools/pip[3] implicitly install Python dependencies. Also use ipaddress package instead of ipaddr.
This commit is contained in:
parent
7bee5093f1
commit
9e34003136
@ -6,22 +6,25 @@ ENV DEBIAN_FRONTEND=noninteractive
|
|||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
# Dependencies for sonic-cfggen
|
build-essential \
|
||||||
python-lxml \
|
|
||||||
python-yaml \
|
|
||||||
python-bitarray \
|
|
||||||
python-pip \
|
python-pip \
|
||||||
|
python3-pip \
|
||||||
python-dev \
|
python-dev \
|
||||||
|
python3-dev \
|
||||||
apt-utils \
|
apt-utils \
|
||||||
python-setuptools
|
python-setuptools \
|
||||||
|
python3-setuptools
|
||||||
|
|
||||||
RUN pip install --upgrade pip
|
RUN pip2 install --upgrade pip
|
||||||
|
RUN pip3 install --upgrade pip
|
||||||
|
RUN apt-get purge -y python-pip python3-pip
|
||||||
|
|
||||||
RUN pip install \
|
# For sonic-config-engine Python 3 package
|
||||||
netaddr \
|
# Explicitly install pyangbind here, as pyangbind causes enum34 to be installed.
|
||||||
ipaddr \
|
# enum34 causes Python 're' package to not work properly as it redefines an incompatible enum.py module
|
||||||
jinja2 \
|
# https://github.com/robshakir/pyangbind/issues/232
|
||||||
pyangbind==0.6.0
|
RUN pip3 install pyangbind==0.8.1
|
||||||
|
RUN pip3 uninstall -y enum34
|
||||||
|
|
||||||
{% if docker_config_engine_buster_debs.strip() %}
|
{% if docker_config_engine_buster_debs.strip() %}
|
||||||
# Copy locally-built Debian package dependencies
|
# Copy locally-built Debian package dependencies
|
||||||
@ -44,8 +47,9 @@ COPY ["files/swss_vars.j2", "/usr/share/sonic/templates/"]
|
|||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get purge -y \
|
RUN apt-get purge -y \
|
||||||
python-pip \
|
python-dev \
|
||||||
python-dev && \
|
python3-dev \
|
||||||
|
build-essential && \
|
||||||
apt-get clean -y && \
|
apt-get clean -y && \
|
||||||
apt-get autoclean -y && \
|
apt-get autoclean -y && \
|
||||||
apt-get autoremove -y && \
|
apt-get autoremove -y && \
|
||||||
|
@ -7,21 +7,13 @@ ENV DEBIAN_FRONTEND=noninteractive
|
|||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
# Dependencies for sonic-cfggen
|
# Dependencies for sonic-cfggen
|
||||||
python-lxml \
|
build-essential \
|
||||||
python-yaml \
|
|
||||||
python-bitarray \
|
|
||||||
python-pip \
|
python-pip \
|
||||||
python-dev \
|
python-dev \
|
||||||
python-setuptools
|
python-setuptools
|
||||||
|
|
||||||
RUN pip install --upgrade pip
|
RUN pip install --upgrade pip
|
||||||
|
|
||||||
RUN pip install \
|
|
||||||
netaddr \
|
|
||||||
ipaddr \
|
|
||||||
jinja2 \
|
|
||||||
pyangbind==0.5.10
|
|
||||||
|
|
||||||
{% if docker_config_engine_stretch_debs.strip() %}
|
{% if docker_config_engine_stretch_debs.strip() %}
|
||||||
# Copy locally-built Debian package dependencies
|
# Copy locally-built Debian package dependencies
|
||||||
{{ copy_files("debs/", docker_config_engine_stretch_debs.split(' '), "/debs/") }}
|
{{ copy_files("debs/", docker_config_engine_stretch_debs.split(' '), "/debs/") }}
|
||||||
@ -43,6 +35,7 @@ COPY ["files/swss_vars.j2", "/usr/share/sonic/templates/"]
|
|||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get purge -y \
|
RUN apt-get purge -y \
|
||||||
|
build-essential \
|
||||||
python-pip \
|
python-pip \
|
||||||
python-dev && \
|
python-dev && \
|
||||||
apt-get clean -y && \
|
apt-get clean -y && \
|
||||||
|
@ -6,11 +6,11 @@ ENV DEBIAN_FRONTEND=noninteractive
|
|||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
|
|
||||||
# Dependencies for sonic-cfggen
|
# Dependencies for sonic-cfggen
|
||||||
RUN apt-get install -y python-lxml python-yaml python-bitarray python-pip python-dev
|
RUN apt-get install -y build-essential python-pip python-dev
|
||||||
|
|
||||||
RUN pip install --upgrade pip
|
RUN pip install --upgrade pip
|
||||||
|
|
||||||
RUN pip install netaddr ipaddr jinja2 pyangbind==0.5.10
|
RUN apt-get purge -y python-pip
|
||||||
|
|
||||||
{% if docker_config_engine_debs.strip() %}
|
{% if docker_config_engine_debs.strip() %}
|
||||||
COPY \
|
COPY \
|
||||||
@ -46,5 +46,5 @@ python-wheels/{{ whl }}{{' '}}
|
|||||||
COPY ["files/swss_vars.j2", "/usr/share/sonic/templates/"]
|
COPY ["files/swss_vars.j2", "/usr/share/sonic/templates/"]
|
||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get purge -y python-pip python-dev; apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
RUN apt-get purge -y build-essential python-dev; apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
||||||
RUN rm -rf /debs /python-wheels
|
RUN rm -rf /debs /python-wheels
|
||||||
|
@ -4,7 +4,7 @@ FROM docker-config-engine-buster
|
|||||||
ARG docker_container_name
|
ARG docker_container_name
|
||||||
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
## Make apt-get non-interactive
|
# Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
@ -18,10 +18,14 @@ RUN apt-get update && \
|
|||||||
libmnl0 \
|
libmnl0 \
|
||||||
bridge-utils \
|
bridge-utils \
|
||||||
conntrack \
|
conntrack \
|
||||||
ndppd
|
ndppd \
|
||||||
|
# Needed for installing netifaces Python package
|
||||||
|
build-essential \
|
||||||
|
python-dev \
|
||||||
|
python3-dev
|
||||||
|
|
||||||
{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %}
|
{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %}
|
||||||
## Fix for gcc/python not found in arm docker
|
# Fix for gcc/python not found in arm docker
|
||||||
RUN apt-get install -f -y python2.7 python2.7-dev
|
RUN apt-get install -f -y python2.7 python2.7-dev
|
||||||
RUN apt-get install -y gcc-6
|
RUN apt-get install -y gcc-6
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -53,10 +57,14 @@ RUN apt-get remove -y gcc-6
|
|||||||
{{ install_debian_packages(docker_orchagent_debs.split(' ')) }}
|
{{ install_debian_packages(docker_orchagent_debs.split(' ')) }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
## Clean up
|
# Clean up
|
||||||
RUN apt-get clean -y && \
|
RUN apt-get purge -y \
|
||||||
apt-get autoclean -y && \
|
build-essential \
|
||||||
apt-get autoremove -y && \
|
python-dev \
|
||||||
|
python3-dev && \
|
||||||
|
apt-get clean -y && \
|
||||||
|
apt-get autoclean -y && \
|
||||||
|
apt-get autoremove -y && \
|
||||||
rm -rf /debs
|
rm -rf /debs
|
||||||
|
|
||||||
COPY ["files/arp_update", "/usr/bin"]
|
COPY ["files/arp_update", "/usr/bin"]
|
||||||
@ -68,7 +76,7 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
|
|||||||
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
|
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
|
||||||
COPY ["critical_processes", "/etc/supervisor/"]
|
COPY ["critical_processes", "/etc/supervisor/"]
|
||||||
|
|
||||||
## Copy all Jinja2 template files into the templates folder
|
# Copy all Jinja2 template files into the templates folder
|
||||||
COPY ["*.j2", "/usr/share/sonic/templates/"]
|
COPY ["*.j2", "/usr/share/sonic/templates/"]
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/bin/docker-init.sh"]
|
ENTRYPOINT ["/usr/bin/docker-init.sh"]
|
||||||
|
@ -7,7 +7,7 @@ RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%s
|
|||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y g++ python-dev
|
apt-get install -y g++ python-dev libxml2
|
||||||
|
|
||||||
RUN pip install connexion==1.1.15 \
|
RUN pip install connexion==1.1.15 \
|
||||||
setuptools==21.0.0 \
|
setuptools==21.0.0 \
|
||||||
|
@ -6,7 +6,7 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return
|
|||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{% macro install_python2_wheels(packages) -%}
|
{% macro install_python2_wheels(packages) -%}
|
||||||
RUN cd /python-wheels/ && pip install {{ packages | join(' ') }}
|
RUN cd /python-wheels/ && pip2 install {{ packages | join(' ') }}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{% macro install_python3_wheels(packages) -%}
|
{% macro install_python3_wheels(packages) -%}
|
||||||
|
@ -93,10 +93,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/iptables_*.deb || \
|
|||||||
# Install dependencies for SONiC config engine
|
# Install dependencies for SONiC config engine
|
||||||
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \
|
||||||
python-dev \
|
python-dev \
|
||||||
python3-dev \
|
python3-dev
|
||||||
python-lxml \
|
|
||||||
python-yaml \
|
|
||||||
python-bitarray
|
|
||||||
|
|
||||||
# Install Python client for Redis
|
# Install Python client for Redis
|
||||||
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install "redis==3.5.3"
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install "redis==3.5.3"
|
||||||
|
@ -61,20 +61,20 @@ RUN curl -o redis-server_6.0.6-1~bpo10+1_amd64.deb "https://sonicstorage.blob.co
|
|||||||
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_amd64.deb redis-server_6.0.6-1~bpo10+1_amd64.deb || apt-get install -f
|
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_amd64.deb redis-server_6.0.6-1~bpo10+1_amd64.deb || apt-get install -f
|
||||||
RUN rm redis-tools_6.0.6-1~bpo10+1_amd64.deb redis-server_6.0.6-1~bpo10+1_amd64.deb
|
RUN rm redis-tools_6.0.6-1~bpo10+1_amd64.deb redis-server_6.0.6-1~bpo10+1_amd64.deb
|
||||||
|
|
||||||
RUN pip install setuptools
|
RUN pip2 install setuptools
|
||||||
RUN pip3 install setuptools
|
RUN pip3 install setuptools
|
||||||
RUN pip install py2_ipaddress
|
RUN pip2 install py2_ipaddress
|
||||||
RUN pip install six
|
RUN pip2 install six
|
||||||
RUN pip install pyroute2==0.5.3 netifaces==0.10.7
|
RUN pip2 install pyroute2==0.5.3 netifaces==0.10.7
|
||||||
RUN pip install monotonic==1.5
|
RUN pip2 install monotonic==1.5
|
||||||
RUN pip install urllib3
|
RUN pip2 install urllib3
|
||||||
RUN pip install requests
|
RUN pip2 install requests
|
||||||
RUN pip install crontab
|
RUN pip2 install crontab
|
||||||
|
|
||||||
# Install dependencies for Dynamic Port Breakout
|
# Install dependencies for Dynamic Port Breakout
|
||||||
RUN pip install xmltodict==0.12.0
|
RUN pip2 install xmltodict==0.12.0
|
||||||
RUN pip install jsondiff==1.2.0
|
RUN pip2 install jsondiff==1.2.0
|
||||||
RUN pip install ijson==2.6.1
|
RUN pip2 install ijson==2.6.1
|
||||||
|
|
||||||
{% if docker_sonic_vs_debs.strip() -%}
|
{% if docker_sonic_vs_debs.strip() -%}
|
||||||
# Copy locally-built Debian package dependencies
|
# Copy locally-built Debian package dependencies
|
||||||
@ -109,7 +109,7 @@ COPY python-wheels/{{ whl }} python-wheels/
|
|||||||
# install PKGs after copying all PKGs to avoid dependency failure
|
# install PKGs after copying all PKGs to avoid dependency failure
|
||||||
# use py3 to find python3 package, which is forced by wheel as of now
|
# use py3 to find python3 package, which is forced by wheel as of now
|
||||||
{%- for whl in docker_sonic_vs_whls.split(' ') %}
|
{%- for whl in docker_sonic_vs_whls.split(' ') %}
|
||||||
RUN pip{% if 'py3' in whl %}3{% endif %} install python-wheels/{{ whl }}
|
RUN pip{% if 'py3' in whl %}3{% else %}2{% endif %} install python-wheels/{{ whl }}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -4,8 +4,11 @@ DOCKER_CONFIG_ENGINE_BUSTER = docker-config-engine-buster.gz
|
|||||||
$(DOCKER_CONFIG_ENGINE_BUSTER)_PATH = $(DOCKERS_PATH)/docker-config-engine-buster
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_PATH = $(DOCKERS_PATH)/docker-config-engine-buster
|
||||||
|
|
||||||
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SWSSSDK_PY2)
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SWSSSDK_PY2)
|
||||||
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SWSSSDK_PY3)
|
||||||
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2)
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2)
|
||||||
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3)
|
||||||
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2)
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2)
|
||||||
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY3)
|
||||||
$(DOCKER_CONFIG_ENGINE_BUSTER)_LOAD_DOCKERS += $(DOCKER_BASE_BUSTER)
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_LOAD_DOCKERS += $(DOCKER_BASE_BUSTER)
|
||||||
$(DOCKER_CONFIG_ENGINE_BUSTER)_FILES += $(SWSS_VARS_TEMPLATE)
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_FILES += $(SWSS_VARS_TEMPLATE)
|
||||||
|
|
||||||
|
@ -6,11 +6,13 @@ $(SONIC_CONFIG_ENGINE_PY2)_DEPENDS += $(SWSSSDK_PY2) $(SONIC_PY_COMMON_PY2)
|
|||||||
$(SONIC_CONFIG_ENGINE_PY2)_PYTHON_VERSION = 2
|
$(SONIC_CONFIG_ENGINE_PY2)_PYTHON_VERSION = 2
|
||||||
SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2)
|
SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2)
|
||||||
|
|
||||||
|
|
||||||
# SONIC_CONFIG_ENGINE_PY3 package
|
# SONIC_CONFIG_ENGINE_PY3 package
|
||||||
|
|
||||||
SONIC_CONFIG_ENGINE_PY3 = sonic_config_engine-1.0-py3-none-any.whl
|
SONIC_CONFIG_ENGINE_PY3 = sonic_config_engine-1.0-py3-none-any.whl
|
||||||
$(SONIC_CONFIG_ENGINE_PY3)_SRC_PATH = $(SRC_PATH)/sonic-config-engine
|
$(SONIC_CONFIG_ENGINE_PY3)_SRC_PATH = $(SRC_PATH)/sonic-config-engine
|
||||||
$(SONIC_CONFIG_ENGINE_PY3)_DEPENDS += $(SWSSSDK_PY3) $(SONIC_PY_COMMON_PY3)
|
$(SONIC_CONFIG_ENGINE_PY3)_DEPENDS += $(SWSSSDK_PY3) $(SONIC_PY_COMMON_PY3)
|
||||||
|
# Synthetic dependency to avoid building the Python 2 and 3 packages
|
||||||
|
# simultaneously and any potential conflicts which may arise
|
||||||
|
$(SONIC_CONFIG_ENGINE_PY3)_DEPENDS += $(SONIC_CONFIG_ENGINE_PY2)
|
||||||
$(SONIC_CONFIG_ENGINE_PY3)_PYTHON_VERSION = 3
|
$(SONIC_CONFIG_ENGINE_PY3)_PYTHON_VERSION = 3
|
||||||
SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY3)
|
SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY3)
|
||||||
|
@ -57,10 +57,10 @@ RUN apt-get update && apt-get install -y \
|
|||||||
libtinyxml2-dev \
|
libtinyxml2-dev \
|
||||||
python \
|
python \
|
||||||
python-pip \
|
python-pip \
|
||||||
|
python3-pip \
|
||||||
libncurses5-dev \
|
libncurses5-dev \
|
||||||
texinfo \
|
texinfo \
|
||||||
dh-autoreconf \
|
dh-autoreconf \
|
||||||
python3-pip \
|
|
||||||
doxygen \
|
doxygen \
|
||||||
devscripts \
|
devscripts \
|
||||||
git-buildpackage \
|
git-buildpackage \
|
||||||
@ -245,13 +245,6 @@ RUN apt-get update && apt-get install -y \
|
|||||||
python3-sphinx \
|
python3-sphinx \
|
||||||
# For sonic config engine testing
|
# For sonic config engine testing
|
||||||
python-dev \
|
python-dev \
|
||||||
python-lxml \
|
|
||||||
python3-lxml \
|
|
||||||
python-jinja2 \
|
|
||||||
python-netaddr \
|
|
||||||
python-ipaddr \
|
|
||||||
python-yaml \
|
|
||||||
python3-yaml \
|
|
||||||
# For lockfile
|
# For lockfile
|
||||||
procmail \
|
procmail \
|
||||||
# For gtest
|
# For gtest
|
||||||
@ -305,7 +298,14 @@ RUN apt-get update && apt-get install -y \
|
|||||||
# For SWI Tools
|
# For SWI Tools
|
||||||
python-m2crypto \
|
python-m2crypto \
|
||||||
# For build dtb
|
# For build dtb
|
||||||
device-tree-compiler
|
device-tree-compiler \
|
||||||
|
# For sonic-mgmt-framework
|
||||||
|
autoconf \
|
||||||
|
m4 \
|
||||||
|
libxml2-utils \
|
||||||
|
xsltproc \
|
||||||
|
python-lxml \
|
||||||
|
libexpat1-dev
|
||||||
|
|
||||||
## Config dpkg
|
## Config dpkg
|
||||||
## install the configuration file if it’s currently missing
|
## install the configuration file if it’s currently missing
|
||||||
@ -334,29 +334,33 @@ RUN export VERSION=1.14.2 \
|
|||||||
&& echo 'export PATH=$PATH:$GOROOT/bin' >> /etc/bash.bashrc \
|
&& echo 'export PATH=$PATH:$GOROOT/bin' >> /etc/bash.bashrc \
|
||||||
&& rm go$VERSION.linux-*.tar.gz
|
&& rm go$VERSION.linux-*.tar.gz
|
||||||
|
|
||||||
|
RUN pip2 install --upgrade pip
|
||||||
|
RUN pip3 install --upgrade pip
|
||||||
|
RUN apt-get purge -y python-pip python3-pip
|
||||||
|
|
||||||
# For building Python packages
|
# For building Python packages
|
||||||
RUN pip install setuptools==40.8.0
|
RUN pip2 install setuptools==40.8.0
|
||||||
RUN pip3 install setuptools==49.6.00
|
RUN pip3 install setuptools==49.6.00
|
||||||
|
|
||||||
# For building sonic-utilities
|
# For building sonic-utilities
|
||||||
RUN pip install fastentrypoints
|
RUN pip2 install fastentrypoints
|
||||||
RUN pip3 install fastentrypoints
|
RUN pip3 install fastentrypoints
|
||||||
|
|
||||||
# For running Python unit tests
|
# For running Python unit tests
|
||||||
RUN pip install pytest-runner==4.4
|
RUN pip2 install pytest-runner==4.4
|
||||||
RUN pip3 install pytest-runner==5.2
|
RUN pip3 install pytest-runner==5.2
|
||||||
RUN pip install mockredispy==2.9.3
|
RUN pip2 install mockredispy==2.9.3
|
||||||
RUN pip3 install mockredispy==2.9.3
|
RUN pip3 install mockredispy==2.9.3
|
||||||
|
|
||||||
# For Python 2 unit tests, we need 'mock'. The last version of 'mock'
|
# For Python 2 unit tests, we need 'mock'. The last version of 'mock'
|
||||||
# which supports Python 2 is 3.0.5. In Python 3, 'mock' is part of 'unittest'
|
# which supports Python 2 is 3.0.5. In Python 3, 'mock' is part of 'unittest'
|
||||||
# in the standard library
|
# in the standard library
|
||||||
RUN pip install mock==3.0.5
|
RUN pip2 install mock==3.0.5
|
||||||
|
|
||||||
# For p4 build
|
# For p4 build
|
||||||
RUN pip install \
|
RUN pip2 install \
|
||||||
ctypesgen==1.0.2 \
|
ctypesgen==1.0.2 \
|
||||||
crc16
|
crc16
|
||||||
|
|
||||||
# For sonic config engine testing
|
# For sonic config engine testing
|
||||||
# Install pyangbind here, outside sonic-config-engine dependencies, as pyangbind causes enum34 to be installed.
|
# Install pyangbind here, outside sonic-config-engine dependencies, as pyangbind causes enum34 to be installed.
|
||||||
@ -366,31 +370,35 @@ RUN pip3 install pyangbind==0.8.1
|
|||||||
RUN pip3 uninstall -y enum34
|
RUN pip3 uninstall -y enum34
|
||||||
|
|
||||||
# For templating
|
# For templating
|
||||||
RUN pip install j2cli==0.3.10
|
RUN pip2 install j2cli==0.3.10
|
||||||
|
|
||||||
RUN pip3 install "PyYAML>=5.1"
|
# For sonic-mgmt-framework
|
||||||
|
RUN pip2 install "PyYAML==5.3.1"
|
||||||
|
RUN pip3 install "PyYAML==5.3.1"
|
||||||
|
RUN pip2 install "lxml==4.6.1"
|
||||||
|
RUN pip3 install "lxml==4.6.1"
|
||||||
|
|
||||||
# For sonic-platform-common testing
|
# For sonic-platform-common testing
|
||||||
RUN pip3 install redis
|
RUN pip3 install redis
|
||||||
|
|
||||||
# For supervisor build
|
# For supervisor build
|
||||||
RUN pip install meld3
|
RUN apt-get install python-meld3
|
||||||
|
|
||||||
# For vs image build
|
# For vs image build
|
||||||
RUN pip install pexpect==4.6.0
|
RUN pip2 install pexpect==4.6.0
|
||||||
|
|
||||||
# For sonic-swss-common testing
|
# For sonic-swss-common testing
|
||||||
RUN pip install Pympler==0.8
|
RUN pip2 install Pympler==0.8
|
||||||
|
|
||||||
# For sonic_yang_mgmt build
|
# For sonic_yang_mgmt build
|
||||||
RUN pip install ijson==2.6.1
|
RUN pip2 install ijson==2.6.1
|
||||||
RUN pip3 install ijson==2.6.1
|
RUN pip3 install ijson==2.6.1
|
||||||
RUN pip install jsondiff==1.2.0
|
RUN pip2 install jsondiff==1.2.0
|
||||||
RUN pip install xmltodict==0.12.0
|
RUN pip2 install xmltodict==0.12.0
|
||||||
RUN pip install pyang==2.1.1
|
RUN pip2 install pyang==2.1.1
|
||||||
|
|
||||||
# For mgmt-framework build
|
# For mgmt-framework build
|
||||||
RUN pip install mmh3
|
RUN pip2 install mmh3
|
||||||
RUN apt-get install -y xsltproc
|
RUN apt-get install -y xsltproc
|
||||||
|
|
||||||
# Install dependencies for isc-dhcp-relay build
|
# Install dependencies for isc-dhcp-relay build
|
||||||
@ -434,4 +442,4 @@ RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs\"" >> /etc/default/d
|
|||||||
RUN update-alternatives --set iptables /usr/sbin/iptables-legacy
|
RUN update-alternatives --set iptables /usr/sbin/iptables-legacy
|
||||||
|
|
||||||
# Install swi tools
|
# Install swi tools
|
||||||
RUN python -m pip install git+https://github.com/aristanetworks/swi-tools.git@d51761ec0bb93c73039233f3c01ed48235ffad00
|
RUN pip2 install git+https://github.com/aristanetworks/swi-tools.git@d51761ec0bb93c73039233f3c01ed48235ffad00
|
||||||
|
@ -57,10 +57,10 @@ RUN apt-get update && apt-get install -y \
|
|||||||
libtinyxml2-dev \
|
libtinyxml2-dev \
|
||||||
python \
|
python \
|
||||||
python-pip \
|
python-pip \
|
||||||
|
python3-pip \
|
||||||
libncurses5-dev \
|
libncurses5-dev \
|
||||||
texinfo \
|
texinfo \
|
||||||
dh-autoreconf \
|
dh-autoreconf \
|
||||||
python3-pip \
|
|
||||||
doxygen \
|
doxygen \
|
||||||
devscripts \
|
devscripts \
|
||||||
git-buildpackage \
|
git-buildpackage \
|
||||||
@ -244,13 +244,6 @@ RUN apt-get update && apt-get install -y \
|
|||||||
python3-sphinx \
|
python3-sphinx \
|
||||||
# For sonic config engine testing
|
# For sonic config engine testing
|
||||||
python-dev \
|
python-dev \
|
||||||
python-lxml \
|
|
||||||
python3-lxml \
|
|
||||||
python-jinja2 \
|
|
||||||
python-netaddr \
|
|
||||||
python-ipaddr \
|
|
||||||
python-yaml \
|
|
||||||
python3-yaml \
|
|
||||||
# For lockfile
|
# For lockfile
|
||||||
procmail \
|
procmail \
|
||||||
# For pam_tacplus build
|
# For pam_tacplus build
|
||||||
@ -298,7 +291,14 @@ RUN apt-get update && apt-get install -y \
|
|||||||
# For libyang
|
# For libyang
|
||||||
swig \
|
swig \
|
||||||
# For SWI Tools
|
# For SWI Tools
|
||||||
python-m2crypto
|
python-m2crypto \
|
||||||
|
# For sonic-mgmt-framework
|
||||||
|
autoconf \
|
||||||
|
m4 \
|
||||||
|
libxml2-utils \
|
||||||
|
xsltproc \
|
||||||
|
python-lxml \
|
||||||
|
libexpat1-dev
|
||||||
|
|
||||||
## Config dpkg
|
## Config dpkg
|
||||||
## install the configuration file if it’s currently missing
|
## install the configuration file if it’s currently missing
|
||||||
@ -330,13 +330,17 @@ RUN export VERSION=1.14.2 \
|
|||||||
&& echo 'export PATH=$PATH:$GOROOT/bin' >> /etc/bash.bashrc \
|
&& echo 'export PATH=$PATH:$GOROOT/bin' >> /etc/bash.bashrc \
|
||||||
&& rm go$VERSION.linux-*.tar.gz
|
&& rm go$VERSION.linux-*.tar.gz
|
||||||
|
|
||||||
|
RUN pip2 install --upgrade pip
|
||||||
|
RUN pip3 install --upgrade pip
|
||||||
|
RUN apt-get purge -y python-pip python3-pip
|
||||||
|
|
||||||
# For p4 build
|
# For p4 build
|
||||||
RUN pip install \
|
RUN pip2 install \
|
||||||
ctypesgen==0.r125 \
|
ctypesgen==0.r125 \
|
||||||
crc16
|
crc16
|
||||||
|
|
||||||
# Note: Stick with Jinja2 2.x branch as the 3.x dropped support for Python 2.7
|
# Note: Stick with Jinja2 2.x branch as the 3.x dropped support for Python 2.7
|
||||||
RUN pip install --force-reinstall --upgrade "Jinja2<3.0.0"
|
RUN pip2 install --force-reinstall --upgrade "Jinja2<3.0.0"
|
||||||
|
|
||||||
# For sonic config engine testing
|
# For sonic config engine testing
|
||||||
# Install pyangbind here, outside sonic-config-engine dependencies, as pyangbind causes enum34 to be installed.
|
# Install pyangbind here, outside sonic-config-engine dependencies, as pyangbind causes enum34 to be installed.
|
||||||
@ -346,39 +350,44 @@ RUN pip3 install pyangbind==0.8.1
|
|||||||
RUN pip3 uninstall -y enum34
|
RUN pip3 uninstall -y enum34
|
||||||
|
|
||||||
# For templating
|
# For templating
|
||||||
RUN pip install j2cli==0.3.10
|
RUN pip2 install j2cli==0.3.10
|
||||||
|
|
||||||
# For sonic snmpagent mock testing
|
# For sonic snmpagent mock testing
|
||||||
RUN pip3 install mockredispy==2.9.3
|
RUN pip3 install mockredispy==2.9.3
|
||||||
|
|
||||||
RUN pip3 install "PyYAML>=5.1"
|
# For sonic-mgmt-framework
|
||||||
|
RUN pip2 install "PyYAML==5.3.1"
|
||||||
|
RUN pip3 install "PyYAML==5.3.1"
|
||||||
|
RUN pip2 install "lxml==4.6.1"
|
||||||
|
RUN pip3 install "lxml==4.6.1"
|
||||||
|
|
||||||
|
|
||||||
# For sonic-platform-common testing
|
# For sonic-platform-common testing
|
||||||
RUN pip3 install redis
|
RUN pip3 install redis
|
||||||
|
|
||||||
# For supervisor build
|
# For supervisor build
|
||||||
RUN pip install meld3 mock
|
RUN pip2 install meld3 mock
|
||||||
|
|
||||||
# For vs image build
|
# For vs image build
|
||||||
RUN pip install pexpect==4.6.0
|
RUN pip2 install pexpect==4.6.0
|
||||||
|
|
||||||
# For sonic-utilities build
|
# For sonic-utilities build
|
||||||
RUN pip install mockredispy==2.9.3
|
RUN pip2 install mockredispy==2.9.3
|
||||||
RUN pip install pytest-runner==4.4
|
RUN pip2 install pytest-runner==4.4
|
||||||
RUN pip install setuptools==40.8.0
|
RUN pip2 install setuptools==40.8.0
|
||||||
|
|
||||||
# For sonic-swss-common testing
|
# For sonic-swss-common testing
|
||||||
RUN pip install Pympler==0.8
|
RUN pip2 install Pympler==0.8
|
||||||
|
|
||||||
# For sonic_yang_mgmt build
|
# For sonic_yang_mgmt build
|
||||||
RUN pip install ijson==2.6.1
|
RUN pip2 install ijson==2.6.1
|
||||||
RUN pip3 install ijson==2.6.1
|
RUN pip3 install ijson==2.6.1
|
||||||
RUN pip install jsondiff==1.2.0
|
RUN pip2 install jsondiff==1.2.0
|
||||||
RUN pip install xmltodict==0.12.0
|
RUN pip2 install xmltodict==0.12.0
|
||||||
RUN pip install pyang==2.1.1
|
RUN pip2 install pyang==2.1.1
|
||||||
|
|
||||||
# For mgmt-framework build
|
# For mgmt-framework build
|
||||||
RUN pip install mmh3
|
RUN pip2 install mmh3
|
||||||
|
|
||||||
# Install dependencies for isc-dhcp-relay build
|
# Install dependencies for isc-dhcp-relay build
|
||||||
RUN apt-get -y build-dep isc-dhcp
|
RUN apt-get -y build-dep isc-dhcp
|
||||||
@ -437,4 +446,4 @@ RUN apt-get install -y docker-ce=18.06.3~ce~3-0~debian
|
|||||||
RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs\"" >> /etc/default/docker
|
RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs\"" >> /etc/default/docker
|
||||||
|
|
||||||
# Install swi tools
|
# Install swi tools
|
||||||
RUN python -m pip install git+https://github.com/aristanetworks/swi-tools.git@d51761ec0bb93c73039233f3c01ed48235ffad00
|
RUN pip2 install git+https://github.com/aristanetworks/swi-tools.git@d51761ec0bb93c73039233f3c01ed48235ffad00
|
||||||
|
@ -2,20 +2,32 @@
|
|||||||
|
|
||||||
import setuptools
|
import setuptools
|
||||||
|
|
||||||
setuptools.setup(name='sonic-bgpcfgd',
|
setuptools.setup(
|
||||||
version='1.0',
|
name = 'sonic-bgpcfgd',
|
||||||
description='Utility to dynamically generate BGP configuration for FRR',
|
version = '1.0',
|
||||||
author='Pavel Shirshov',
|
description = 'Utility to dynamically generate BGP configuration for FRR',
|
||||||
author_email='pavelsh@microsoft.com',
|
author = 'Pavel Shirshov',
|
||||||
url='https://github.com/Azure/sonic-buildimage',
|
author_email = 'pavelsh@microsoft.com',
|
||||||
packages=setuptools.find_packages(),
|
url = 'https://github.com/Azure/sonic-buildimage',
|
||||||
entry_points={
|
packages = setuptools.find_packages(),
|
||||||
'console_scripts': [
|
entry_points = {
|
||||||
'bgpcfgd = bgpcfgd.main:main',
|
'console_scripts': [
|
||||||
'bgpmon = bgpmon.bgpmon:main',
|
'bgpcfgd = bgpcfgd.main:main',
|
||||||
]
|
'bgpmon = bgpmon.bgpmon:main',
|
||||||
},
|
]
|
||||||
install_requires=['jinja2>=2.10', 'netaddr', 'pyyaml'],
|
},
|
||||||
setup_requires=['pytest-runner'],
|
install_requires = [
|
||||||
tests_require=['pytest', 'pytest-cov'],
|
'jinja2>=2.10',
|
||||||
|
'netaddr==0.8.0',
|
||||||
|
'pyyaml==5.3.1',
|
||||||
|
'zipp==1.2.0', # importlib-resources needs zipp and seems to have a bug where it will try to import too new of a version for Python 2
|
||||||
|
],
|
||||||
|
setup_requires = [
|
||||||
|
'pytest-runner',
|
||||||
|
'wheel'
|
||||||
|
],
|
||||||
|
tests_require = [
|
||||||
|
'pytest',
|
||||||
|
'pytest-cov'
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
@ -8,7 +8,7 @@ import socket
|
|||||||
import struct
|
import struct
|
||||||
import json
|
import json
|
||||||
import copy
|
import copy
|
||||||
import ipaddr as ipaddress
|
import ipaddress
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from lxml import etree as ET
|
from lxml import etree as ET
|
||||||
@ -18,6 +18,12 @@ from portconfig import get_port_config
|
|||||||
from sonic_py_common.multi_asic import get_asic_id_from_name
|
from sonic_py_common.multi_asic import get_asic_id_from_name
|
||||||
from sonic_py_common.interface import backplane_prefix
|
from sonic_py_common.interface import backplane_prefix
|
||||||
|
|
||||||
|
# TODO: Remove this once we no longer support Python 2
|
||||||
|
if sys.version_info.major == 3:
|
||||||
|
UNICODE_TYPE = str
|
||||||
|
else:
|
||||||
|
UNICODE_TYPE = unicode
|
||||||
|
|
||||||
"""minigraph.py
|
"""minigraph.py
|
||||||
version_added: "1.9"
|
version_added: "1.9"
|
||||||
author: Guohan Lu (gulv@microsoft.com)
|
author: Guohan Lu (gulv@microsoft.com)
|
||||||
@ -323,8 +329,8 @@ def parse_dpg(dpg, hname):
|
|||||||
for mgmtintf in mgmtintfs.findall(str(QName(ns1, "ManagementIPInterface"))):
|
for mgmtintf in mgmtintfs.findall(str(QName(ns1, "ManagementIPInterface"))):
|
||||||
intfname = mgmtintf.find(str(QName(ns, "AttachTo"))).text
|
intfname = mgmtintf.find(str(QName(ns, "AttachTo"))).text
|
||||||
ipprefix = mgmtintf.find(str(QName(ns1, "PrefixStr"))).text
|
ipprefix = mgmtintf.find(str(QName(ns1, "PrefixStr"))).text
|
||||||
mgmtipn = ipaddress.IPNetwork(ipprefix)
|
mgmtipn = ipaddress.ip_network(UNICODE_TYPE(ipprefix), False)
|
||||||
gwaddr = ipaddress.IPAddress(int(mgmtipn.network) + 1)
|
gwaddr = ipaddress.ip_address(next(mgmtipn.hosts()))
|
||||||
mgmt_intf[(intfname, ipprefix)] = {'gwaddr': gwaddr}
|
mgmt_intf[(intfname, ipprefix)] = {'gwaddr': gwaddr}
|
||||||
|
|
||||||
pcintfs = child.find(str(QName(ns, "PortChannelInterfaces")))
|
pcintfs = child.find(str(QName(ns, "PortChannelInterfaces")))
|
||||||
@ -665,9 +671,9 @@ def parse_spine_chassis_fe(results, vni, lo_intfs, phyport_intfs, pc_intfs, pc_m
|
|||||||
# Vxlan tunnel information
|
# Vxlan tunnel information
|
||||||
lo_addr = '0.0.0.0'
|
lo_addr = '0.0.0.0'
|
||||||
for lo in lo_intfs:
|
for lo in lo_intfs:
|
||||||
lo_network = ipaddress.IPNetwork(lo[1])
|
lo_network = ipaddress.ip_network(UNICODE_TYPE(lo[1]), False)
|
||||||
if lo_network.version == 4:
|
if lo_network.version == 4:
|
||||||
lo_addr = str(lo_network.ip)
|
lo_addr = str(lo_network.network_address)
|
||||||
break
|
break
|
||||||
results['VXLAN_TUNNEL'] = {chassis_vxlan_tunnel: {
|
results['VXLAN_TUNNEL'] = {chassis_vxlan_tunnel: {
|
||||||
'src_ip': lo_addr
|
'src_ip': lo_addr
|
||||||
@ -1174,9 +1180,9 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
|
|||||||
# if erspan_dst:
|
# if erspan_dst:
|
||||||
# lo_addr = '0.0.0.0'
|
# lo_addr = '0.0.0.0'
|
||||||
# for lo in lo_intfs:
|
# for lo in lo_intfs:
|
||||||
# lo_network = ipaddress.IPNetwork(lo[1])
|
# lo_network = ipaddress.ip_network(UNICODE_TYPE(lo[1]), False)
|
||||||
# if lo_network.version == 4:
|
# if lo_network.version == 4:
|
||||||
# lo_addr = str(lo_network.ip)
|
# lo_addr = str(lo_network.network_address)
|
||||||
# break
|
# break
|
||||||
# count = 0
|
# count = 0
|
||||||
# for dst in erspan_dst:
|
# for dst in erspan_dst:
|
||||||
@ -1204,8 +1210,8 @@ def parse_device_desc_xml(filename):
|
|||||||
results['LOOPBACK_INTERFACE'] = {('lo', lo_prefix): {}}
|
results['LOOPBACK_INTERFACE'] = {('lo', lo_prefix): {}}
|
||||||
|
|
||||||
mgmt_intf = {}
|
mgmt_intf = {}
|
||||||
mgmtipn = ipaddress.IPNetwork(mgmt_prefix)
|
mgmtipn = ipaddress.ip_network(UNICODE_TYPE(mgmt_prefix), False)
|
||||||
gwaddr = ipaddress.IPAddress(int(mgmtipn.network) + 1)
|
gwaddr = ipaddress.ip_address((next(mgmtipn.hosts())))
|
||||||
results['MGMT_INTERFACE'] = {('eth0', mgmt_prefix): {'gwaddr': gwaddr}}
|
results['MGMT_INTERFACE'] = {('eth0', mgmt_prefix): {'gwaddr': gwaddr}}
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
@ -1,32 +1,38 @@
|
|||||||
import glob
|
import glob
|
||||||
|
import sys
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
from tests.common_utils import PY3x
|
# Common dependencies for Python 2 and 3
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
# Python 2 or 3 dependencies
|
'bitarray==1.5.3',
|
||||||
|
'ipaddress==1.0.23',
|
||||||
|
'lxml==4.6.1',
|
||||||
|
'netaddr==0.8.0',
|
||||||
|
'pyyaml==5.3.1',
|
||||||
|
'sonic-py-common',
|
||||||
|
]
|
||||||
|
|
||||||
|
if sys.version_info.major == 3:
|
||||||
|
# Python 3-only dependencies
|
||||||
|
dependencies += [
|
||||||
|
# pyangbind v0.8.1 pull down enum43 which causes 're' package to malfunction.
|
||||||
|
# Python3 has enum module and so pyangbind should be installed outside
|
||||||
|
# dependencies section of setuptools followed by uninstall of enum43
|
||||||
|
# 'pyangbind==0.8.1',
|
||||||
|
'Jinja2>=2.10'
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
# Python 2-only dependencies
|
||||||
|
dependencies += [
|
||||||
|
# Jinja2 v3.0.0+ dropped support for Python 2.7 and causes setuptools to
|
||||||
|
# malfunction on stretch slave docker.
|
||||||
'future',
|
'future',
|
||||||
'ipaddr',
|
|
||||||
'lxml',
|
|
||||||
'netaddr',
|
|
||||||
'pyyaml',
|
|
||||||
'sonic-py-common',
|
|
||||||
] + ([
|
|
||||||
# Python 3 dependencies
|
|
||||||
# pyangbind v0.8.1 pull down enum43 which causes 're' package to malfunction.
|
|
||||||
# Python3 has enum module and so pyangbind should be installed outside
|
|
||||||
# dependencies section of setuptools followed by uninstall of enum43
|
|
||||||
# 'pyangbind==0.8.1',
|
|
||||||
'Jinja2>=2.10',
|
|
||||||
] if PY3x
|
|
||||||
else [
|
|
||||||
# Python 2 dependencies
|
|
||||||
# Jinja2 v3.0.0+ dropped support for Python 2.7 and causes setuptools to
|
|
||||||
# malfunction on stretch slave docker.
|
|
||||||
'Jinja2<3.0.0',
|
'Jinja2<3.0.0',
|
||||||
'pyangbind==0.6.0',
|
'pyangbind==0.6.0',
|
||||||
])
|
'zipp==1.2.0', # importlib-resources needs zipp and seems to have a bug where it will try to install too new of a version for Python 2
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = 'sonic-config-engine',
|
name = 'sonic-config-engine',
|
||||||
@ -52,6 +58,7 @@ setup(
|
|||||||
],
|
],
|
||||||
setup_requires= [
|
setup_requires= [
|
||||||
'pytest-runner',
|
'pytest-runner',
|
||||||
|
'wheel'
|
||||||
],
|
],
|
||||||
tests_require=[
|
tests_require=[
|
||||||
'pytest',
|
'pytest',
|
||||||
@ -69,4 +76,3 @@ setup(
|
|||||||
],
|
],
|
||||||
keywords = 'SONiC sonic-cfggen config-engine PYTHON python'
|
keywords = 'SONiC sonic-cfggen config-engine PYTHON python'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user