Closed sdputurn closed 4 years ago
Using the softlayer api you can only get a general information of the Firewall (fortigate) as vlan, router, subnets, where the firewall was added and the credentials to access to the fortigate server such as username, password and Management ip, as shown in the control portal.
In order to obtain data such as serial, model, manufacturer, etc., you have to enter to the "fortigate" server with the credentials mentioned above provided by the softlayer api or the portal control.
You can use this python example to obtain the credentials and the ip management of the fortigate and you will be able to enter to the server as in the image below.
"""
GetObject Network_Vlan_Firewall
getObject returns a SoftLayer_Network_Vlan_Firewall object. You can only get objects for vlans attached to your account
that have a network firewall enabled.
Important manual pages:
https://softlayer.github.io/reference/services/SoftLayer_Network_Vlan_Firewall/getObject/
https://softlayer.github.io/reference/datatypes/SoftLayer_Network_Vlan_Firewall/
License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
"""
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
API_USERNAME = 'set me'
# Generate one at https://control.softlayer.com/account/users
API_KEY = 'set me'
firewallId = 11111
objectMask = 'mask[billingItem,customerManagedFlag,fullyQualifiedDomainName,managementCredentials,networkVlan[id,' \
'firewallInterfaces,primaryRouter[hostname,id],vlanNumber],primaryIpAddress, bypassRequestStatus]'
client = SoftLayer.create_client_from_env(
username=API_USERNAME,
api_key=API_KEY
)
try:
orderStatus = client['SoftLayer_Network_Vlan_Firewall'].getObject(mask = objectMask, id = firewallId)
print(orderStatus)
except SoftLayer.SoftLayerAPIError as e:
pp('Unable to get the firewall information faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
You will get a response like this example:
{
"primaryIpAddress": "11.111.111.111",
"billingItem": {
"allowCancellationFlag": 1,
"categoryCode": "vlan_firewall",
"description": "FortiGate Security Appliance",
"id":11111
},
"managementCredentials": {
"createDate": "2018-07-31T15:16:23-06:00",
"id": 2222222,
"modifyDate": "2018-07-31T15:16:23-06:00",
"password": "password12345",
"port": 23,
"softwareId": 1111111,
"username": "SL45454"
}
Use the "primaryIpAddress" as the url and the credential username and password to login to the fortigate server.
@allmightyspiff thanks for the update. when i open the link i get error - "This card may be on a private board. If someone gave you this link, they may need to invite you to one of their boards or teams."
@FernandoOjeda thanks for the update. but this will be difficult for me. I am Inventory owner, my job is to get the device details and load them to our inventory database. I was using SL api's to fetch these details and load them. I am not the system owner and should not ssh to these boxes.
is there any other possible solution? if not (i guess this is what you mentioned in your reply), i am happy to close this ticket.
@sdputurn I'll double check because i thought we provided the serial from the API.
Aside from logging into the fortigate, it doesn't look like the serial is available in the API directly.
If you are just keeping track of inventory, the ID
field is unique for all firewalls. Or the billingItem->orderItemId
might also be useful in keeping track of items.
Hi team, we are using Softlayer for our infrastructure. to record Configuration Items CI inventory for servers in SL. we need device information. i am not able to get device information for fortigate devices.
I have tried below:
thanks Sandeep