Port

Import OPBNOS API

from opbclient import opb_api as opbapi

Initialize client

Use the appropriate JSON file that corresponds to the targetted device name. This JSON file should contain request body parameters corresponding to any potential configuration/post requests.

node = opbapi.connect_to('SN2010')

Configure Port Interfaces

node.configAllInterfaces()

The API configAllInterfaces() requires no parameters because the file SN2010.json contains all the required parameters in order to configure device interfaces. The content of the JSON file is in the following format:

        "configInterface": {
                "Ethernet1_1": {
                        "admin_status": "up",
                        "speed": "10000"
                }

Configure Specific Port Interfaces

node.configInterface(intf_name="Ethernet1_1")

The API configInterface() requires one client specified parameter, intf_name, that indicates the preferred configuration parameters by referring to the appropriate request body content in the user inputted JSON file. The content of the JSON file should be in the following format:

        "configInterface": {
                "Ethernet1_1": {
                        "admin_status": "up",
                        "speed": "10000"
                }

The below table has a list of attributes that pertain to these particular APIs:

Attribute Values Description
"admin_status" "up/down" check device activity
"speed" int device speed
"mtu" int maximum transmission size of an interface
"fec" "none/fc/rs" forward error correction

Get/Show Port Interface

Retrieves device interface elements that were previously configured.

node.execute(['show interfaces summary <Ethernet1_1>'])

Output

This is an example of the output of the above command.

b'{"Ethernet1_1": {"admin_status": "up", "speed": "10000"}}'

The below table is a list of out attributes pertaining to the interface get request:

Attribute Values Description
"lanes" "int" device data lanes
"alias" "tenGigE1" alias name for port interface
"oper_status" "down/up" status the port is currently operating at
"admin_status" "up/down" indicates configured state of the device
"speed" int device speed
"mtu" int maximum transmission size of an interface
"description" "N/A" any specificity descriptions
"autoneg" "N/A" used to determine the optimal speed and mode of connection for two connected devices
"TRANSCEIVER" "Present" indicates whether a device transceiver is present