Add CLI scripts from osken to be installed via setup.cfg

Instead of keeping hardcoded files in bin/ directory it is
more flexible to install such files using setup.cfg file.
It will for example install files with correct shebang for
python2 and python3.

This patch also removes tools/osken-manager.spec file
as it was used by PyInstaller in Ryu and it isn't used
in os-ken.

Change-Id: Ie85c64d81c86f0059528ad4d8e238a4124d4e5b4
This commit is contained in:
Slawek Kaplonski 2018-12-12 14:29:05 +01:00
parent eb94ee01bc
commit a74bac9100
16 changed files with 33 additions and 95 deletions

View File

@ -1,20 +0,0 @@
#!/usr/bin/env python
# Copyright (C) 2014 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2014 YAMAMOTO Takashi <yamamoto at valinux co jp>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from os_ken.cmd.osken_base import main
main()

View File

@ -1,19 +0,0 @@
#!/usr/bin/env python
# Copyright (C) 2011, 2012 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from os_ken.cmd.manager import main
main()

View File

@ -5,7 +5,7 @@ Components of OS-Ken
Executables
===========
bin/osken-manager
osken-manager
------------------
The main executable.

View File

@ -102,7 +102,7 @@ Invoking Example
================
The example is as follows::
% PYTHONPATH=. ./bin/osken-manager --wsapi-port 8081 --verbose --app-lists os_ken.app.simple_isolation,os_ken.app.rest
% osken-manager --wsapi-port 8081 --verbose --app-lists os_ken.app.simple_isolation,os_ken.app.rest
loading app os_ken.app.simple_isolation
loading app os_ken.app.rest
loading app os_ken.controller.ofp_handler

View File

@ -87,7 +87,7 @@ Usage
2. Run OS-Ken with sample application: ::
$ sudo ./bin/osken-manager os_ken/app/simple_switch_snort.py
$ sudo osken-manager os_ken/app/simple_switch_snort.py
The incoming packets will all mirror to **port 3** which should be connect to Snort network interface. You can modify the mirror port by assign a new value in the ``self.snort_port = 3`` of ``simple_switch_snort.py``
@ -114,7 +114,7 @@ The incoming packets will all mirror to **port 3** which should be connect to Sn
2. Run OS-Ken with sample application (On the Controller): ::
$ ./bin/osken-manager os_ken/app/simple_switch_snort.py
$ osken-manager os_ken/app/simple_switch_snort.py
3. Run Snort (On the Snort machine): ::

View File

@ -187,4 +187,4 @@ Run test_of_config app::
If you don't install os_ken and are working in the git repo directly::
# PYTHONPATH=. ./bin/osken-manager --verbose os_ken.tests.integrated.test_of_config os_ken.app.rest
# osken-manager --verbose os_ken.tests.integrated.test_of_config os_ken.app.rest

View File

@ -20,9 +20,9 @@ VRRPManager creates/deletes VRRPRouter, VRRPInterfaceMonitor
dynamically as requested.
Usage example
PYTHONPATH=. ./bin/osken-manager --verbose \
os_ken.services.protocols.vrrp.manager \
os_ken.services.protocols.vrrp.dumper
osken-manager --verbose \
os_ken.services.protocols.vrrp.manager \
os_ken.services.protocols.vrrp.dumper
"""
import time

View File

@ -18,10 +18,10 @@
sample router manager.
(un-)instantiate routers
Usage example:
PYTHONPATH=. ./bin/osken-manager --verbose \
os_ken.services.protocols.vrrp.manager \
os_ken.services.protocols.vrrp.dumper \
os_ken.services.protocols.vrrp.sample_manager
osken-manager --verbose \
os_ken.services.protocols.vrrp.manager \
os_ken.services.protocols.vrrp.dumper \
os_ken.services.protocols.vrrp.sample_manager
"""
from os_ken.base import app_manager

View File

@ -20,10 +20,10 @@ a template for router implementation that support VRRP
Those routers needs to be created by someone else.
sample_manager.routerManager is an example.
Usage example:
PYTHONPATH=. ./bin/osken-manager --verbose \
os_ken.services.protocols.vrrp.manager \
os_ken.services.protocols.vrrp.dumper \
os_ken.services.protocols.vrrp.sample_manager
osken-manager --verbose \
os_ken.services.protocols.vrrp.manager \
os_ken.services.protocols.vrrp.dumper \
os_ken.services.protocols.vrrp.sample_manager
"""
import contextlib

View File

@ -29,7 +29,7 @@ TIMEOUT = 60
OSKEN_HOST = '127.0.0.1'
OSKEN_PORT = 6633
PYTHON_BIN = '.venv/bin/python'
OSKEN_MGR = './bin/osken-manager'
OSKEN_MGR = 'osken-manager'
class OVS12KernelSwitch(OVSKernelSwitch):

View File

@ -33,7 +33,7 @@ Then run linc
# rel/linc/bin/linc console
Then run os_ken
# PYTHONPATH=. ./bin/osken-manager --verbose \
# osken-manager --verbose \
os_ken/tests/integrated/test_of_config.py

View File

@ -16,11 +16,11 @@
r"""
Usage:
PYTHONPATH=. ./bin/osken-manager --verbose \
os_ken.services.protocols.vrrp.dumper \
os_ken.services.protocols.vrrp.sample_manager.py \
os_ken.tests.integrated.test_vrrp_linux_multi \
os_ken.app.rest
osken-manager --verbose \
os_ken.services.protocols.vrrp.dumper \
os_ken.services.protocols.vrrp.sample_manager.py \
os_ken.tests.integrated.test_vrrp_linux_multi \
os_ken.app.rest
os_ken.services.protocols.vrrp.dumper is optional.
os_ken.app.rest is merely to prevent osken-manager from exiting.

View File

@ -16,10 +16,10 @@
r"""
Usage:
PYTHONPATH=. ./bin/osken-manager --verbose \
os_ken.topology.switches \
os_ken.tests.integrated.test_vrrp_multi \
os_ken.services.protocols.vrrp.dumper
osken-manager --verbose \
os_ken.topology.switches \
os_ken.tests.integrated.test_vrrp_multi \
os_ken.services.protocols.vrrp.dumper
os_ken.services.protocols.vrrp.dumper is optional.

View File

@ -90,7 +90,7 @@ run_tests() {
run_pylint() {
echo "Running pylint ..."
PYLINT_OPTIONS="--rcfile=.pylintrc --output-format=parseable"
PYLINT_INCLUDE="os_ken bin/osken bin/osken-manager os_ken/tests/bin/osken-client"
PYLINT_INCLUDE="os_ken os_ken/tests/bin/osken-client"
export PYTHONPATH=$PYTHONPATH:.os_ken
PYLINT_LOG=pylint.log

View File

@ -22,6 +22,11 @@ classifier =
packages =
os_ken
[entry_points]
console_scripts =
osken = os_ken.cmd.osken_base:main
osken-manager = os_ken.cmd.manager:main
[compile_catalog]
directory = os_ken/locale
domain = os_ken

View File

@ -1,28 +0,0 @@
# -*- mode: python -*-
block_cipher = None
a = Analysis(['../bin/osken-manager'],
pathex=['../os_ken'],
binaries=None,
datas=None,
hiddenimports=['os_ken.controller.ofp_handler'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='osken-manager',
debug=False,
strip=False,
upx=True,
console=True)