Fortinet Document Library

Version:


Table of Contents

Fortinet Device Package 2.4 for Cisco ACI

Fortinet Device Package for Cisco ACI 2.5 Release Notes

Fortinet Device Package for Cisco ACI 2.4 Release Notes

SDN Connector Cisco ACI Administration Guide

SDN Connector 1.1.3 Release Notes

SDN Connector 1.1.2 Release Notes

Resources

Upgrade Path Tool
6.2.0
Download PDF
Copy Link

Monitoring SDN connector status using an API

You can monitor SDN connector status using a REST API that Fortinet SDN Connector for Cisco ACI and Nuage Networks provides.

Request:

/api/status

Response:

Format: json

Key

Type

Possible values

Description

in_sync

Boolean

  • true
  • false

Whether endpoints are synchronized with upstream SDN controller.

rpc_listener

String

  • connected
  • disconnected
  • uninitialized

Send and receive notifications to and from FortiOS and FortiManager.

  • connected: SDN connector connected to RabbitMQ for receiving and sending notifications
  • disconnected: connection to RabbitMQ is down.
  • uninitialized: SDN connector has not initialized connection with RabbitMQ yet, during startup stage

sdn_controller

String
  • connected
  • disconnected

Controller that the SDN connector connects to in order to get endpoint updates.

  • connected: SDN connector connection to SDN controller is successful.
  • disconnected: SDN connector connection to SDN controller fails due to outage or invalid username/password or has not completed yet.

sdn_controller_host

String
  • IP address
  • FQDN

IP address or FQDN of the SDN controller that the SDN connector is connecting to.

type

String

  • aci
  • nuage

Current SDN controller type.

time

Integer

Epoch time in seconds

Current epoch time stamp.

usage

Dictionary

 

 

usage.cpu

Float

0-100

SDN connector CPU usage.

usage.mem

Float

0-100

SDN connector memory usage.

version

String

x.x.x

Version number in major.minor.patch format.

The following is an example of the output:

{
  "in_sync": true,
  "rpc_listener": "connected",
  "sdn_controller": "connected",
  "sdn_controller_host": "x.x.x.x",
  "time": 1584398898,
  "type": "aci",
  "usage": {
    "cpu": 7.6,
    "mem": 69.7
  },
  "version": "1.1.3"
}

The following shows sample code for monitoring the SDN connector using this API:

#!/usr/bin/env python
import re
import requests


class SdnConnectorClient(object):

    def __init__(self, host, password, user="admin@sdn-connector.local"):
        self.host = host
        self.base_url = "https://" + host
        self.user = user
        self.password = password
        self.csrf = None
        self.cookies = None

    def login(self):
        login_page = requests.get(self.base_url + '/login', verify=False)
        session = login_page.cookies
        regex = re.compile(".+csrf_token=\\'(\S+)\\'.+")
        self.csrf = regex.search(login_page.text).group(1)
        form = {"email": self.user, "password": self.password,
                "csrf_token": self.csrf, "submit": "Login", "next": "/"}
        res = requests.post(self.base_url + '/login', data=form,
                            verify=False, cookies=session,
                            headers={'referer': self.base_url})
        self.cookies = res.cookies

    def get_status(self):
        res = self.get('/api/status')
        return res[1]

    def get(self, path):
        res = requests.get(self.base_url + path, cookies=self.cookies,
                           verify=False)
        return res.status_code, res.text

    def post(self, path, data):
        res = requests.post(self.base_url + path, cookies=self.cookies,
                            data=data, verify=False)
        return res.status_code, res.text

if __name__ == "__main__":
    sdn_client = SdnConnectorClient('localhost', 'xxxxxx')
    sdn_client.login()
    print sdn_client.get_status()

Resources

Monitoring SDN connector status using an API

You can monitor SDN connector status using a REST API that Fortinet SDN Connector for Cisco ACI and Nuage Networks provides.

Request:

/api/status

Response:

Format: json

Key

Type

Possible values

Description

in_sync

Boolean

  • true
  • false

Whether endpoints are synchronized with upstream SDN controller.

rpc_listener

String

  • connected
  • disconnected
  • uninitialized

Send and receive notifications to and from FortiOS and FortiManager.

  • connected: SDN connector connected to RabbitMQ for receiving and sending notifications
  • disconnected: connection to RabbitMQ is down.
  • uninitialized: SDN connector has not initialized connection with RabbitMQ yet, during startup stage

sdn_controller

String
  • connected
  • disconnected

Controller that the SDN connector connects to in order to get endpoint updates.

  • connected: SDN connector connection to SDN controller is successful.
  • disconnected: SDN connector connection to SDN controller fails due to outage or invalid username/password or has not completed yet.

sdn_controller_host

String
  • IP address
  • FQDN

IP address or FQDN of the SDN controller that the SDN connector is connecting to.

type

String

  • aci
  • nuage

Current SDN controller type.

time

Integer

Epoch time in seconds

Current epoch time stamp.

usage

Dictionary

 

 

usage.cpu

Float

0-100

SDN connector CPU usage.

usage.mem

Float

0-100

SDN connector memory usage.

version

String

x.x.x

Version number in major.minor.patch format.

The following is an example of the output:

{
  "in_sync": true,
  "rpc_listener": "connected",
  "sdn_controller": "connected",
  "sdn_controller_host": "x.x.x.x",
  "time": 1584398898,
  "type": "aci",
  "usage": {
    "cpu": 7.6,
    "mem": 69.7
  },
  "version": "1.1.3"
}

The following shows sample code for monitoring the SDN connector using this API:

#!/usr/bin/env python
import re
import requests


class SdnConnectorClient(object):

    def __init__(self, host, password, user="admin@sdn-connector.local"):
        self.host = host
        self.base_url = "https://" + host
        self.user = user
        self.password = password
        self.csrf = None
        self.cookies = None

    def login(self):
        login_page = requests.get(self.base_url + '/login', verify=False)
        session = login_page.cookies
        regex = re.compile(".+csrf_token=\\'(\S+)\\'.+")
        self.csrf = regex.search(login_page.text).group(1)
        form = {"email": self.user, "password": self.password,
                "csrf_token": self.csrf, "submit": "Login", "next": "/"}
        res = requests.post(self.base_url + '/login', data=form,
                            verify=False, cookies=session,
                            headers={'referer': self.base_url})
        self.cookies = res.cookies

    def get_status(self):
        res = self.get('/api/status')
        return res[1]

    def get(self, path):
        res = requests.get(self.base_url + path, cookies=self.cookies,
                           verify=False)
        return res.status_code, res.text

    def post(self, path, data):
        res = requests.post(self.base_url + path, cookies=self.cookies,
                            data=data, verify=False)
        return res.status_code, res.text

if __name__ == "__main__":
    sdn_client = SdnConnectorClient('localhost', 'xxxxxx')
    sdn_client.login()
    print sdn_client.get_status()