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

#
# spec file for package openstack-neutron-opflex-agent
#
# Copyright (c) 2016 SUSE LINUX Products 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 http://bugs.opensuse.org/


Name:           openstack-neutron-opflex-agent
Version:        5.0.0
Release:        0
License:        Apache-2.0
Summary:        Neutron agent for OpFlex based policy enforcement
Url:            https://github.com/noironetworks/python-opflex-agent/
Group:          Development/Languages/Python
#NOTE(varadhan): Source is generated using obs sdist service, from https://github.com/noironetworks/python-opflex-agent.git
Source:         neutron-opflex-agent-%{version}.tar.gz
Source1:        %name.conf
BuildRequires:  python-devel
BuildRequires:  python-pbr
BuildRequires:  systemd
BuildRequires:  systemd-rpm-macros
BuildRequires:  openstack-neutron
Requires:       ipset
Requires:       python-oslo.serialization >= 1.4.0
Requires:       python-oslo.utils >= 2.0.0
Requires:       python-oslo.i18n >= 2.1.0
Requires:       python-oslo.log >= 1.8.0
Requires:       python-oslo.config >= 2.3.0
Requires:       python-pyinotify
Requires:       openstack-neutron
Requires:       openstack-neutron-openvswitch-agent
Requires:       supervisor
%{?systemd_requires}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
Provides edge policy enforcement.

%package test
Summary:        Neutron agent for OpFlex based policy enforcement - Testsuite
Group:          System/Management
Requires:       %{name} = %{version}
Requires:       python-fixtures >= 1.3.1
Requires:       python-mock >= 1.2
Requires:       python-mox >= 0.5.3
Requires:       python-nova
Requires:       python-oslotest >= 1.10.0
Requires:       python-python-subunit >= 0.0.18
Requires:       python-testrepository >= 0.0.18
Requires:       python-testscenarios >= 0.4
Requires:       python-testtools >= 1.4.0
Requires:       python-tempest-lib >= 0.8.0
Requires:       python-cliff >= 1.14.0
Requires:       python-WebTest >= 2.0
Requires:       python-httplib2 >= 0.7.5
Requires:       python-requests-mock >= 0.6.0

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


%prep
%setup -q -n neutron-opflex-agent-%{version}

%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=/usr/bin/neutron-opflex-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/openvswitch_agent.ini --log-file /var/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

%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
%defattr(-,root,root,-)
%doc README.rst
%dir %_tmpfilesdir
%{_tmpfilesdir}/%{name}.conf
%{python_sitelib}/*
%{_bindir}/neutron-opflex-agent
%{_bindir}/opflex-ep-watcher
%{_bindir}/opflex-state-watcher
%{_unitdir}/neutron-opflex-agent.service
%dir %{_sysconfdir}/neutron/
%dir %{_sysconfdir}/neutron/rootwrap.d
%{_sysconfdir}/neutron/rootwrap.d/gbp-opflex.filters
# Part of test subpackage
%exclude %{python_sitelib}/opflexagent/test/

%files test
%defattr(-,root,root)
%dir %{python_sitelib}/opflexagent/test

%changelog