File openstack-neutron-opflex-agent.spec of Package openstack-neutron-opflex-agent

#
# spec file for package openstack-neutron-opflex-agent
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define version_unconverted 7.3.3
Name:           openstack-neutron-opflex-agent
Version:        7.3.3
Release:        0
Summary:        Neutron agent for OpFlex based policy enforcement
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            http://github.com/noironetworks/python-opflex-agent/
Source:         https://github.com/noironetworks/python-opflex-agent/archive/%{version}.tar.gz
Source1:        %{name}.conf
Patch1:         0001_fix_correct_version_of_os-vif.patch
BuildRequires:  openstack-neutron
BuildRequires:  python-devel
BuildRequires:  python-pbr
BuildRequires:  systemd
BuildRequires:  systemd-rpm-macros
Requires:       ipset
Requires:       openstack-neutron
Requires:       openstack-neutron-openvswitch-agent
Requires:       python-os-vif >= 1.7.0
Requires:       python-oslo.config >= 3.14.0
Requires:       python-oslo.i18n >= 2.1.0
Requires:       python-oslo.log >= 3.11.0
Requires:       python-oslo.serialization >= 1.10.0
Requires:       python-oslo.utils >= 3.18.0
Requires:       python-pyinotify
BuildArch:      noarch
%{?systemd_requires}

%description
Provides edge policy enforcement.

%package test
Summary:        Neutron agent for OpFlex based policy enforcement - Testsuite
Group:          System/Management
Requires:       %{name} = %{version}
Requires:       python-WebTest >= 2.0
Requires:       python-cliff >= 2.3.0
Requires:       python-fixtures >= 3.0.0
Requires:       python-httplib2 >= 0.7.5
Requires:       python-mock >= 2.0
Requires:       python-oslotest >= 1.10.0
Requires:       python-python-subunit >= 0.0.18
Requires:       python-requests-mock >= 1.1
Requires:       python-testrepository >= 0.0.18
Requires:       python-testscenarios >= 0.4
Requires:       python-testtools >= 1.4.0

%description test
The testsuite for the Neutron agent for OpFlex based policy enforcement.

%prep
%setup -q -n python-opflex-agent-%{version}
%patch1 -p1

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# systemd service file
# SUSE doesn't have a /usr/share/neutron/neutron-dist.conf so replace the StartExec call
sed -i -e 's!^ExecStart.*!ExecStart=%{_bindir}/neutron-opflex-agent --config-file %{_sysconfdir}/neutron/neutron.conf --config-file %{_sysconfdir}/neutron/plugins/ml2/openvswitch_agent.ini --log-file %{_localstatedir}/log/neutron/opflex-agent.log!' \
    rpm/neutron-opflex-agent.service
install -p -D -m 0644 rpm/neutron-opflex-agent.service \
        %{buildroot}/%{_unitdir}/neutron-opflex-agent.service
# rootwrap filter
install -p -D -m 600 etc/gbp-opflex.filters \
    %{buildroot}%{_sysconfdir}/neutron/rootwrap.d/gbp-opflex.filters
install -D -m 644 %{SOURCE1} %{buildroot}/%{_tmpfilesdir}/%{name}.conf
install -d -m 755 %{buildroot}%{_sysconfdir}/neutron/opflex-agent
mv %{buildroot}%{_prefix}%{_sysconfdir}/neutron/opflex-agent/*.ini %{buildroot}%{_sysconfdir}/neutron/opflex-agent/

%pre
%service_add_pre neutron-opflex-agent.service

%post
%service_add_post neutron-opflex-agent.service
%{_bindir}/systemd-tmpfiles --create %{_tmpfilesdir}/%{name}.conf

%preun
%service_del_preun neutron-opflex-agent.service

%postun
%service_del_postun neutron-opflex-agent.service

%files
%doc README.rst
%dir %{_tmpfilesdir}
%{_tmpfilesdir}/%{name}.conf
%{python_sitelib}/*
%{_bindir}/neutron-opflex-agent
%{_bindir}/opflex-ep-watcher
%{_bindir}/opflex-state-watcher
%{_bindir}/neutron-cisco-apic-host-agent
%{_bindir}/opflex-ns-proxy
%{_bindir}/opflex-conn-track
%{_unitdir}/neutron-opflex-agent.service
%dir %{_sysconfdir}/neutron/
%dir %{_sysconfdir}/neutron/rootwrap.d
%dir %{_sysconfdir}/neutron/opflex-agent
%{_sysconfdir}/neutron/rootwrap.d/gbp-opflex.filters
%{_sysconfdir}/neutron/opflex-agent/apic_topology_service.ini
# Part of test subpackage
%exclude %{python_sitelib}/opflexagent/test/

%files test
%dir %{python_sitelib}/opflexagent/test

%changelog
openSUSE Build Service is sponsored by