-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
------------------ * [new] ./examples/ssh_vdom.py * [change] README.rst ssh
- Loading branch information
vprusakovs
committed
Mar 16, 2023
1 parent
5acdeea
commit 923b95d
Showing
8 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"""SSH examples for working with vdom: | ||
- get system arp from interfaces associated with vdom="VDOM" | ||
- get system arp from interfaces associated with vdom="root" | ||
""" | ||
|
||
from fortigate_api import FortigateAPI | ||
|
||
HOST = "hostname" | ||
USERNAME = "username" | ||
PASSWORD = "password" | ||
VDOM = "VDOM" | ||
|
||
# Fortigate with configured VDOMs. diagnostic commands for custom vdom | ||
fgt_vdom = FortigateAPI(host=HOST, username=USERNAME, password=PASSWORD) | ||
vdom_commands = ["config vdom", f"edit {VDOM}"] | ||
output = fgt_vdom.ssh.send_config_set(vdom_commands) | ||
print(output) | ||
# config vdom | ||
# | ||
# hostname (vdom) # edit VDOM | ||
# current vf=VDOM:1 | ||
# | ||
# hostname (VDOM) # | ||
|
||
output = fgt_vdom.ssh.send_command("get system arp") | ||
print(output) | ||
# hostname (VDOM) # | ||
# Address Age(min) Hardware Addr Interface | ||
# 10.0.1.1 0 00:00:00:00:00:71 v1000 | ||
# 10.0.4.1 0 00:00:00:00:00:71 v4000 | ||
|
||
# Fortigate with configured VDOMs. diagnostic commands for vdom=root | ||
fgt_root = FortigateAPI(host=HOST, username=USERNAME, password=PASSWORD) | ||
vdom_commands = ["config vdom", "edit root"] | ||
output = fgt_root.ssh.send_config_set(vdom_commands) | ||
print(output) | ||
# config vdom | ||
# | ||
# hostname (vdom) # edit root | ||
# current vf=root:0 | ||
# | ||
# hostname (root) # | ||
|
||
output = fgt_root.ssh.send_command("get system arp") | ||
print(output) | ||
# hostname (root) # | ||
# Address Age(min) Hardware Addr Interface | ||
# 10.0.5.1 7 00:00:00:00:00:71 v5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[project] | ||
name = "fortigate_api" | ||
version = "1.1.0" | ||
version = "1.1.1" | ||
authors = [ | ||
{ name="Vladimir Prusakov", email="[email protected]" }, | ||
] | ||
|
@@ -31,7 +31,7 @@ classifiers = [ | |
"Homepage" = "https://github.com/vladimirs-git/fortigate-api" | ||
"Repository" = "https://github.com/vladimirs-git/fortigate-api" | ||
"Bug Tracker" = "https://github.com/vladimirs-git/fortigate-api/issues" | ||
"Download URL" = "https://github.com/vladimirs-git/fortigate-api/archive/refs/tags/1.1.0.tar.gz" | ||
"Download URL" = "https://github.com/vladimirs-git/fortigate-api/archive/refs/tags/1.1.1.tar.gz" | ||
[tool.setuptools.packages.find] | ||
include = ["fortigate_api"] | ||
[tool.setuptools.package-data] | ||
|
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters