Forum Discussion
F5-SDK Installation
Hi All,
Need your help to install F5-SDK for LTM VM.
Regards,
Ashish Solanki
Hello Ashish.
I've tested in linux mint without any issue.
You can check my log steps attached.
KR,
Dario.
Hello Ashish.
Use pip command:
REF - https://devcentral.f5.com/s/articles/getting-started-with-the-f5-common-python-sdk-27438
KR,
Dario.
Hi Dario,
Is it necessary to have internet connectivity to install SDK because my LAB VM is not connected to internet.
Is this command need to be run in F5 VM itself, right (I'm not sure that's why asking)?
Regards,
Ashish Solanki
Hello Ashish.
First, if you don't have previous experience, I recommend you to start with a graphical IDE (PyCharm in my case) and internet connection.
F5 SDK is composed by several modules and each of them have their own dependencies, so you would need to satisfy these requirements before having your enviroment ready to work.
If you access F5 Github repository you will see some of the modules provided by F5 SDK and their requirements.
- f5-common-python
- f5-icontrol-rest-python
REF - https://github.com/F5Networks
You can check what your current installed modules are in your enviroment with this:
# python Python 2.6.6 (r266:84292, Aug 2 2019, 14:05:33) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> help("modules") Please wait a moment while I gather a list of all available modules... [...output omitted] >>> exit()
To install modules with internet:
REF - https://packaging.python.org/tutorials/installing-packages/
To install modules without internet:
REF - https://stackoverflow.com/questions/11091623/how-to-install-packages-offline
KR,
Dario.
Hi Dario,
Thanks for sharing above documents and URLs. I had installed the f5-SDK however while accessing the device getting below error:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ashi2.com', port=443): Max retries exceeded with url: /mgmt/tm/sys/ (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f078c5b66a0>: Failed to establish a new connection: [Errno -2] Name or service not known',))
This is surely related to self-signed SSL cert. Can you please help me how I can disable cert checking on the F5 ltm or any other way around you can suggest.
Can i do ssh to my box instead of accessing it via HTTPS:
Regards,
Ashish Solanki
No. This error comes from your 'requests' library and means that you cannot reach your device or resource.
Max retries exceeded with url: /mgmt/tm/sys/ (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f078c5b66a0>: Failed to establish a new connection: [Errno -2] Name or service not known',))
Insecure warnings looks like this:
InsecureRequestWarning: Unverified HTTPS request is being made to host '<BIG-IP Device>'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning,
But these warnings should be disabled by default.
So check your destination IP, user privileges and so on.
BTW, if these answers were helpful don't forget to mark the answer as 'the best' or give some upvotes.
KR,
Dario.
I am able to ssh my F5 LTM from CentOS8 on which I had installed f5-sdk :
[root@localhost ~]# ssh root@192.168.70.14
[root@ASHI:Active:Disconnected] config #
Device hostname is ASHI.com
I have only one user on my f5 i.e. admin which is having Administrator provildges and advanced sheel access also.
If you can help me out what else needs to be checked on both CentOS and F5 LTM.
Regards,
Ashish Solanki
Dario,
Please have a look at below error:
2020-04-12 13:30:11,960 - f5sdk.utils.http_utils - WARNING: SSL Insecure request, recommend adding a valid certificate to the device
this clearly show issue with SSL cer. Don't know how to suppress this cert error. Let me know if you have any suggestion to suppress this.
Regards,
Ashish Solanki
Please, share your code.
Hi Dario,
Below are the steps which I followed:
1. Executed this command on Centos8 pip install f5-sdk
Got message successfully installed.
2. Excuted Python3 command and tried executed below commands:
>>> import requests
>>> requests.packages.urllib3.disable_warnings()
>>> from f5.bigip import ManagementRoot -----------------> after executing this command getting error which I has shared.
>>> # Basic Authentication
>>> b = ManagementRoot('ltm3.test.local', 'admin', 'admin')
>>> # Token Authentication
>>> b = ManagementRoot('ltm3.test.local', 'admin', 'admin', token=True)
>>> b.tmos_version
u'12.1.0'
3. I am able to ssh my F5 LTM from CentOS ----> ssh admin@192.168.70.14 ----> successfully logged in into the LTM
4. when I execute print(requests.get('https://ashi.com')) getting error related to SSL cert.
5. I have one user for LTM i.e. admin/admin which is having Administrator priviledges and access to advanced shell also.
6. LTM is connected to internet also.
https://devcentral.f5.com/s/articles/getting-started-with-the-f5-common-python-sdk-27438 ----> followed this article and in this it is mentioned:
"I disable the certificate security warnings on my test boxes, but the first two lines in the sample code below are not necessary if you are using valid certificates"
Let me know if I am missing anythin here.
Regards,
Ashish Solanki
The mentioned command ("from f5.bigip import ManagementRoot") only loads the libraries, it doesn't send anyting to anywhere.
F5 SDK has several dependencies like for example 'f5-icontrol-rest-python', so my suspect is you need to satisfy these other dependencies before getting your box working properly.
Use 'pip search' to search for other f5 packets and try to download them all.
Check also with "help('modules')" to see what F5 modules you have installed...
Dario,
Below are the requirements that are fullfilled:
## required production packages
requests==2.22.0
retry==0.9.2
paramiko==2.6.0
## required dev packages
pytest==4.3.1
pytest-mock==1.10.4
pytest-cov==2.6.1
pylint==2.3.1 ; python_version > '3.0'
safety==1.8.5
behave==1.2.6
# unittest.mock built in to python 3.3+
mock==2.0.0 ; python_version < '3.3'
## required doc packages
sphinx==2.0.1 ; python_version > '3.0'
f5-sphinx-theme==2.0.5 ; python_version > '3.0'
## required build packages
twine==3.* ; python_version >= '3.0'
twine==1.* ; python_version <= '3.0'
=====================================================
root@ubuntu:~# pip3 search f5-sdk-python/
f5-sdk-python (0.9.2) - F5 SDK
INSTALLED: 0.9.2 (latest)
f5-sdk (3.0.21) - F5 Networks Python SDK
INSTALLED: 3.0.21 (latest)
f5 (0.0.4) - Use F5 to build more powerful Tornado apps
INSTALLED: 0.0.4 (latest)
f5-cli (0.9.2) - F5 CLI
INSTALLED: 0.9.2 (latest)
f5-teem (1.0.2) - F5 TEEM Library
INSTALLED: 1.0.2 (latest)
f5-sphinx-theme (2.0.5) - Sphinx theme for F5 Networks
INSTALLED: 2.0.5 (latest)
f5-openstack-agent (10.1.0) - F5 Networks Agent for OpenStack services
httpie-f5-auth (0.0.6) - F5 BIG-IQ Auth plugin for HTTPie.
INSTALLED: 0.0.6 (latest)
f5-icontrol-rest (1.3.13) - F5 BIG-IP iControl REST API client
INSTALLED: 1.3.13 (latest)
Still struggling how to get this thiing working.
Cloned f5-sdk from github and ran this requirement.txt to fullfill all the python related dependencies.
Attached is the file of Python modules
Trying searching for videos but no luck if you have any video source how to insatll f5-sdk that would be very helpful.
Regards,
Ashish Solanki
Hello Ashish.
I've tested in linux mint without any issue.
You can check my log steps attached.
KR,
Dario.
HI Dario,
Thanks for sharing the details. After making entery in host file for my LB VM, I can access F5-SDK.
Regards.
Ashish Solanki
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com