File agent-ovs.spec of Package agent-ovs

#
# spec file for package agent-ovs
#
# Copyright (c) 2016 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 http://bugs.opensuse.org/
#


Name:           agent-ovs
Version:        1.3.0
Release:        0
Summary:        Agent for integrating group-based policy with Open vSwitch
License:        EPL-1.0
# FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group:          System Environment/Daemons
Url:            https://wiki.opendaylight.org/view/OpFlex:Main
Source:         https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/opflex/%{name}/%{version}/%{name}-%{version}.tar.gz
Patch0:         static-ovs.diff
BuildRequires:  automake
BuildRequires:  gcc-c++
BuildRequires:  boost-devel
BuildRequires:  doxygen
BuildRequires:  libmodelgbp-devel
BuildRequires:  libopflex-devel
BuildRequires:  openvswitch-gbp-devel-static >= 2.4.1
BuildRequires:  openssl-devel
BuildRequires:  rapidjson-devel >= 1.0
BuildRequires:  systemd-rpm-macros
BuildRequires:  pkg-config
Requires:       openvswitch-switch >= 2.4.0
Requires:       openvswitch-kmp >= 2.4.0
Requires(pre):  openstack-neutron
Requires(pre):  /usr/bin/getent /usr/sbin/groupadd 
%{?systemd_requires}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The Opflex agent runs alongside the management plane of a network
packet forwarding entity such as Open vSwitch and enforces group-based
policy semantics on the network traffic.

%prep
%setup -q
%patch0 -p0

%build
%configure --disable-assert
make %{?_smp_mflags}

%install
%make_install
install -p -D -m 0644 rpm/agent-ovs.service \
    %{buildroot}%{_unitdir}/agent-ovs.service
install -p -D -m 0644 rpm/mcast-daemon.service \
    %{buildroot}%{_unitdir}/mcast-daemon.service
install -p -D -m 0644 rpm/90-agent-ovs-sysctl.conf \
    %{buildroot}%{_sysctldir}/90-agent-ovs-sysctl.conf
mkdir -p %{buildroot}%{_localstatedir}/lib/opflex-agent-ovs/endpoints
mkdir -p %{buildroot}%{_localstatedir}/lib/opflex-agent-ovs/services
mkdir -p %{buildroot}%{_localstatedir}/lib/opflex-agent-ovs/ids
mkdir -p %{buildroot}%{_localstatedir}/lib/opflex-agent-ovs/mcast
mkdir -p %{buildroot}%{_sysconfdir}/opflex-agent-ovs/conf.d


%pre
getent group opflexep >/dev/null || groupadd -r opflexep
%service_add_pre agent-ovs.service
%service_add_pre mcast-daemon.service

%post
%service_add_post agent-ovs.service
%service_add_post mcast-daemon.service

%preun
%service_del_preun agent-ovs.service
%service_del_preun mcast-daemon.service

%postun
%service_del_postun agent-ovs.service
%service_del_postun mcast-daemon.service


%files
%defattr(-,root,root)
%{_bindir}/agent_ovs
%{_bindir}/mcast_daemon
%{_bindir}/gbp_inspect
%config(noreplace) %{_sysconfdir}/opflex-agent-ovs/opflex-agent-ovs.conf
%dir %{_sysconfdir}/opflex-agent-ovs/
%dir %{_sysconfdir}/opflex-agent-ovs/conf.d
%{_unitdir}/agent-ovs.service
%{_unitdir}/mcast-daemon.service
%{_sysctldir}/90-agent-ovs-sysctl.conf
%dir %attr(0775, neutron, neutron) %{_localstatedir}/lib/opflex-agent-ovs
%dir %attr(0775, neutron, neutron) %{_localstatedir}/lib/opflex-agent-ovs/endpoints
%dir %attr(0775, neutron, neutron) %{_localstatedir}/lib/opflex-agent-ovs/services
%dir %{_localstatedir}/lib/opflex-agent-ovs/mcast
%dir %{_localstatedir}/lib/opflex-agent-ovs/ids

%changelog
openSUSE Build Service is sponsored by