diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-alteon-sdk.spec | 264 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 266 insertions, 0 deletions
@@ -0,0 +1 @@ +/alteon-sdk-0.11b2.tar.gz diff --git a/python-alteon-sdk.spec b/python-alteon-sdk.spec new file mode 100644 index 0000000..73fab6c --- /dev/null +++ b/python-alteon-sdk.spec @@ -0,0 +1,264 @@ +%global _empty_manifest_terminate_build 0 +Name: python-alteon-sdk +Version: 0.11b2 +Release: 1 +Summary: Python Alteon SDK +License: Apache 2.0 +URL: https://pypi.python.org/pypi/alteon-sdk +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/71/6f/5182393f36c2baad836581e1ac653506219bf65be40b6f3076813973c9af/alteon-sdk-0.11b2.tar.gz +BuildArch: noarch + + +%description +- provide API for developers to interact with Alteon structures in Python environment via REST Backend +- access to Alteon Management & Configuration functions +- abstract configuration model to alteon elements via consistent Declarative-style Configurators +in this model a consistent object structures are exposed to user per configurator type. +each configurator handle base commands over a device (READ, READ_ALL, DELETE, UPDATE & DEPLOY) +the package handles the binding & translation between alteon device to abstract objects +it works both ways: abstract <-> alteon structure, in other words it translate +abstract to alteon configuration and read from alteon into abstract type. +multi choices (enums) are consumed dynamically from the beans package. +developer can choose to work with string_value/int/enums directly +the SDK is requires Python >3.6 +Minimum Supported Alteon Versions: + 31.0.10.0, + 32.2.2.0 +device direct API, Configurators and Management are available via the Alteon client module: +```pycon +from radware.alteon.client import AlteonClient +from radware.alteon.beans.SlbNewCfgEnhRealServerTable import * +alteon_client_params = dict( + validate_certs=False, + user='admin', + password='admin', + https_port=443, + server='172.16.1.1', + timeout=15, +) +client = AlteonClient(**alteon_client_params) +# read bean from device: +bean = SlbNewCfgEnhRealServerTable() +bean.Index = 'real_1' +print(client.api.device.read(bean)) +# work with Configurators: +client.api.mgmt.config.commit() +print(client.api.mgmt.info.software) +print(client.api.conf.type.dns_responders.read_all()) +server_params = ServerParameters() +server_params.index = 'real1' +server_params.ip_address = '3.3.3.3' +client.api.conf.execute('deploy', server_params, dry_run=True, write_on_change=True, get_diff=True) +``` +another way of use is directly via the desire Configurator: +```pycon +from radware.alteon.sdk.configurators.server import * +connection = AlteonConnection(**alteon_client_params) +server_configurator = ServerConfigurator(connection) +server_params = ServerParameters() +server_params.index = 'real1' +server_params.ip_address = '3.3.3.3' +server_params.availability = 5 +server_params.server_ports = [56, 78] +server_params.weight = 5 +server_params.server_type = EnumSlbRealServerType.remote_server +server_params.state = EnumSlbRealServerState.enabled +server_configurator.deploy(server_params) +``` +OR the configuration manager: +```pycon +from radware.sdk.configurator import DeviceConfigurator, DeviceConfigurationManager +from radware.alteon.sdk.configurators.ssl_key import SSLKeyConfigurator +ssl_key_configurator = SSLKeyConfigurator(**alteon_client_params) +cfg_mng = DeviceConfigurationManager() +result = cfg_mng.execute(ssl_key_configurator, DeviceConfigurator.READ_ALL, None, passphrase=passphrase) +print(result.content_translate) +``` +further details & doc will be added later + +%package -n python3-alteon-sdk +Summary: Python Alteon SDK +Provides: python-alteon-sdk +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-alteon-sdk +- provide API for developers to interact with Alteon structures in Python environment via REST Backend +- access to Alteon Management & Configuration functions +- abstract configuration model to alteon elements via consistent Declarative-style Configurators +in this model a consistent object structures are exposed to user per configurator type. +each configurator handle base commands over a device (READ, READ_ALL, DELETE, UPDATE & DEPLOY) +the package handles the binding & translation between alteon device to abstract objects +it works both ways: abstract <-> alteon structure, in other words it translate +abstract to alteon configuration and read from alteon into abstract type. +multi choices (enums) are consumed dynamically from the beans package. +developer can choose to work with string_value/int/enums directly +the SDK is requires Python >3.6 +Minimum Supported Alteon Versions: + 31.0.10.0, + 32.2.2.0 +device direct API, Configurators and Management are available via the Alteon client module: +```pycon +from radware.alteon.client import AlteonClient +from radware.alteon.beans.SlbNewCfgEnhRealServerTable import * +alteon_client_params = dict( + validate_certs=False, + user='admin', + password='admin', + https_port=443, + server='172.16.1.1', + timeout=15, +) +client = AlteonClient(**alteon_client_params) +# read bean from device: +bean = SlbNewCfgEnhRealServerTable() +bean.Index = 'real_1' +print(client.api.device.read(bean)) +# work with Configurators: +client.api.mgmt.config.commit() +print(client.api.mgmt.info.software) +print(client.api.conf.type.dns_responders.read_all()) +server_params = ServerParameters() +server_params.index = 'real1' +server_params.ip_address = '3.3.3.3' +client.api.conf.execute('deploy', server_params, dry_run=True, write_on_change=True, get_diff=True) +``` +another way of use is directly via the desire Configurator: +```pycon +from radware.alteon.sdk.configurators.server import * +connection = AlteonConnection(**alteon_client_params) +server_configurator = ServerConfigurator(connection) +server_params = ServerParameters() +server_params.index = 'real1' +server_params.ip_address = '3.3.3.3' +server_params.availability = 5 +server_params.server_ports = [56, 78] +server_params.weight = 5 +server_params.server_type = EnumSlbRealServerType.remote_server +server_params.state = EnumSlbRealServerState.enabled +server_configurator.deploy(server_params) +``` +OR the configuration manager: +```pycon +from radware.sdk.configurator import DeviceConfigurator, DeviceConfigurationManager +from radware.alteon.sdk.configurators.ssl_key import SSLKeyConfigurator +ssl_key_configurator = SSLKeyConfigurator(**alteon_client_params) +cfg_mng = DeviceConfigurationManager() +result = cfg_mng.execute(ssl_key_configurator, DeviceConfigurator.READ_ALL, None, passphrase=passphrase) +print(result.content_translate) +``` +further details & doc will be added later + +%package help +Summary: Development documents and examples for alteon-sdk +Provides: python3-alteon-sdk-doc +%description help +- provide API for developers to interact with Alteon structures in Python environment via REST Backend +- access to Alteon Management & Configuration functions +- abstract configuration model to alteon elements via consistent Declarative-style Configurators +in this model a consistent object structures are exposed to user per configurator type. +each configurator handle base commands over a device (READ, READ_ALL, DELETE, UPDATE & DEPLOY) +the package handles the binding & translation between alteon device to abstract objects +it works both ways: abstract <-> alteon structure, in other words it translate +abstract to alteon configuration and read from alteon into abstract type. +multi choices (enums) are consumed dynamically from the beans package. +developer can choose to work with string_value/int/enums directly +the SDK is requires Python >3.6 +Minimum Supported Alteon Versions: + 31.0.10.0, + 32.2.2.0 +device direct API, Configurators and Management are available via the Alteon client module: +```pycon +from radware.alteon.client import AlteonClient +from radware.alteon.beans.SlbNewCfgEnhRealServerTable import * +alteon_client_params = dict( + validate_certs=False, + user='admin', + password='admin', + https_port=443, + server='172.16.1.1', + timeout=15, +) +client = AlteonClient(**alteon_client_params) +# read bean from device: +bean = SlbNewCfgEnhRealServerTable() +bean.Index = 'real_1' +print(client.api.device.read(bean)) +# work with Configurators: +client.api.mgmt.config.commit() +print(client.api.mgmt.info.software) +print(client.api.conf.type.dns_responders.read_all()) +server_params = ServerParameters() +server_params.index = 'real1' +server_params.ip_address = '3.3.3.3' +client.api.conf.execute('deploy', server_params, dry_run=True, write_on_change=True, get_diff=True) +``` +another way of use is directly via the desire Configurator: +```pycon +from radware.alteon.sdk.configurators.server import * +connection = AlteonConnection(**alteon_client_params) +server_configurator = ServerConfigurator(connection) +server_params = ServerParameters() +server_params.index = 'real1' +server_params.ip_address = '3.3.3.3' +server_params.availability = 5 +server_params.server_ports = [56, 78] +server_params.weight = 5 +server_params.server_type = EnumSlbRealServerType.remote_server +server_params.state = EnumSlbRealServerState.enabled +server_configurator.deploy(server_params) +``` +OR the configuration manager: +```pycon +from radware.sdk.configurator import DeviceConfigurator, DeviceConfigurationManager +from radware.alteon.sdk.configurators.ssl_key import SSLKeyConfigurator +ssl_key_configurator = SSLKeyConfigurator(**alteon_client_params) +cfg_mng = DeviceConfigurationManager() +result = cfg_mng.execute(ssl_key_configurator, DeviceConfigurator.READ_ALL, None, passphrase=passphrase) +print(result.content_translate) +``` +further details & doc will be added later + +%prep +%autosetup -n alteon-sdk-0.11b2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-alteon-sdk -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.11b2-1 +- Package Spec generated @@ -0,0 +1 @@ +0bd45f0c4a6ba1d0ca857820d5a7bace alteon-sdk-0.11b2.tar.gz |