File python-networking-cisco.spec of Package python-networking-cisco
#
# spec file for package networking-cisco
#
# 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/
#
%define component networking-cisco
%define groupname neutron
%define version_unconverted 2.1.2.dev24
Name: python-networking-cisco
Version: 2.1.2~dev24
Release: 0
Summary: Cisco for OpenStack Networking (Neutron)
License: Apache-2.0
Group: System/Management
Url: https://github.com/noironetworks/networking-cisco
# source tarball generated from git checkout of https://github.com/noironetworks/networking-cisco/
# using python setup.py sdist
Source: networking-cisco-%{version}.tar.gz
Source1: neutron-cisco-cfg-agent.service
Source2: neutron-cisco-apic-host-agent.service
Source3: neutron-cisco-apic-service-agent.service
Provides: openstack-neutron-plugin-cisco = 2015.2
Obsoletes: openstack-neutron-plugin-cisco < 2015.2
BuildRequires: fdupes
BuildRequires: openstack-suse-macros
BuildRequires: python-setuptools
BuildRequires: python-pbr
BuildRequires: systemd-rpm-macros
Requires: openstack-neutron
Requires: python >= 2.7
Requires: python-Babel >= 1.3
Requires: python-ciscoconfparse >= 1.2.10
Requires: python-ncclient >= 0.4.2
Requires: python-UcsSdk >= 0.8.2
# temporary define to ensure that obs-service-python_requires doesn't find the version to bump
%define lxml_pkg python-lxml
Requires: %lxml_pkg >= 3.1
Requires: python-apicapi
%{?systemd_requires}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
Networking Cisco contains the Cisco vendor code for OpenStack Neutron.
%package test
Summary: Cisco for OpenStack Networking (Neutron) - Testsuite
Group: System/Management
Requires: %{name} = %{version}
Requires: python-oslotest >= 1.10.0
Requires: python-mock >= 1.0
Requires: python-tempest-lib >= 0.1.0
Requires: python-testscenarios >= 0.4
Requires: python-testresources >= 0.2.4
Requires: python-WebTest >= 2.0
Requires: python-python-subunit >= 0.0.18
Requires: python-testtools >= 0.9.36
Requires: python-requests-mock >= 0.5.1
Requires: python-os-testr >= 0.4.1
%description test
The testsuite for the Cisco for OpenStack Networking.
%prep
%setup -q -n %{component}-%{version_unconverted}
sed -i -e 's/lxml>=.*$/lxml>=3.1/' \
networking_cisco.egg-info/requires.txt \
requirements.txt
sed -i '/fabric-enabler/d' ./setup.cfg
sed -i '/neutron-cisco-apic/d' ./setup.cfg
sed -i '/etc\/saf/d' ./setup.cfg
%openstack_cleanup_prep
%build
python setup.py build
%install
python setup.py install --root %{buildroot} --prefix %{_prefix}
# config files
mv %{buildroot}/usr/etc %{buildroot}/%{_sysconfdir}
mkdir -p %{buildroot}%{_sysconfdir}/neutron/plugins/ml2
mkdir -p %{buildroot}%{_sysconfdir}/neutron/plugins/cisco
mkdir -p %{buildroot}%{_sysconfdir}/neutron/rootwrap.d
mv %{buildroot}/etc/neutron/ml2_* %{buildroot}%{_sysconfdir}/neutron/plugins/ml2/
mv %{buildroot}/etc/neutron/cisco_* %{buildroot}%{_sysconfdir}/neutron/plugins/cisco/
%__install -D -m 640 etc/neutron/rootwrap.d/* %{buildroot}/%{_sysconfdir}/neutron/rootwrap.d/
### init scripts (systemd)
mkdir -p %{buildroot}%{_sbindir}
#%__install -D -m 444 %{buildroot}/etc/saf/init/fabric-enabler-server.service %{buildroot}/%{_unitdir}/fabric-enabler-server.service
#%__install -D -m 444 %{buildroot}/etc/saf/init/fabric-enabler-agent.service %{buildroot}/%{_unitdir}/fabric-enabler-agent.service
%__install -p -D -m 444 %{SOURCE1} %{buildroot}/%{_unitdir}/neutron-cisco-cfg-agent.service
#%__install -p -D -m 444 %{SOURCE2} %{buildroot}/%{_unitdir}/neutron-cisco-apic-host-agent.service
#%__install -p -D -m 444 %{SOURCE3} %{buildroot}/%{_unitdir}/neutron-cisco-apic-service-agent.service
# cleanup
#rm -rf %{buildroot}/etc/saf/init/
%fdupes %{buildroot}%{python_sitelib}/
%files
%defattr(-,root,root,-)
%doc LICENSE
%{python_sitelib}/networking_cisco/
%{python_sitelib}/networking_cisco*.egg-info
# Part of test subpackage
%exclude %{python_sitelib}/networking_cisco/tests
# config
#%dir %{_sysconfdir}/saf
%dir %{_sysconfdir}/neutron
%dir %{_sysconfdir}/neutron/plugins
%dir %{_sysconfdir}/neutron/plugins/ml2
%dir %{_sysconfdir}/neutron/plugins/cisco
#%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/saf/enabler_conf.ini
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/neutron/plugins/cisco/cisco_cfg_agent.ini
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/neutron/plugins/cisco/cisco_device_manager_plugin.ini
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/neutron/plugins/cisco/cisco_router_plugin.ini
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/neutron/plugins/cisco/cisco_vpn_agent.ini
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/neutron/plugins/ml2/ml2_conf_cisco.ini
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/neutron/plugins/ml2/ml2_conf_ncs.ini
%dir %{_sysconfdir}/neutron/rootwrap.d/
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/neutron/rootwrap.d/cisco-apic.filters
# bin
#%{_bindir}/fabric-enabler-server
#%{_bindir}/fabric-enabler-agent
#%{_bindir}/fabric-enabler-cli
#%{_bindir}/neutron-cisco-apic-host-agent
#%{_bindir}/neutron-cisco-apic-service-agent
%{_bindir}/neutron-cisco-cfg-agent
# systemd
#%{_unitdir}/fabric-enabler-server.service
#%{_unitdir}/fabric-enabler-agent.service
#%{_unitdir}/neutron-cisco-apic-host-agent.service
#%{_unitdir}/neutron-cisco-apic-service-agent.service
%{_unitdir}/neutron-cisco-cfg-agent.service
%files test
%defattr(-,root,root)
%doc LICENSE
%{python_sitelib}/networking_cisco/tests
%pre
#%service_add_pre fabric-enabler-server.service
#%service_add_pre fabric-enabler-agent.service
%service_add_pre neutron-cisco-cfg-agent.service
#%service_add_pre neutron-cisco-apic-service-agent.service
#%service_add_pre neutron-cisco-apic-host-agent.service
%post
#%service_add_post fabric-enabler-server.service
#%service_add_post fabric-enabler-agent.service
%service_add_post neutron-cisco-cfg-agent.service
#%service_add_post neutron-cisco-apic-service-agent.service
#%service_add_post neutron-cisco-apic-host-agent.service
%preun
#%service_del_preun fabric-enabler-server.service
#%service_del_preun fabric-enabler-agent.service
%service_del_preun neutron-cisco-cfg-agent.service
#%service_del_preun neutron-cisco-apic-service-agent.service
#%service_del_preun neutron-cisco-apic-host-agent.service
%postun
#%service_del_postun fabric-enabler-server.service
#%service_del_postun fabric-enabler-agent.service
%service_del_postun neutron-cisco-cfg-agent.service
#%service_del_postun neutron-cisco-apic-service-agent.service
#%service_del_postun neutron-cisco-apic-host-agent.service
%changelog