Port Channel
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 portchannel information
In order to configure portchannel information, the API, configportchannel(), must be invoked with appropriate parameters in dictionary format.
node.configPortChannel(pch_id="1", port_list=["Ethernet1_1","Ethernet2_1"])
The below table has a list of attributes that pertain to this particular API:
Attribute | Values | Description |
---|---|---|
"add_member" | ["Ethernet1_1", ["Ethernet2_2"], | indicates the members within which the port channels are configured |
"description" | "test" | additional port channel description |
Get Port-channel information
Retrieves server port details
node.execute(['show port-channel information'])
Output
The output is in JSON format.
Note: if port channel is not configured, the device will return the below error messege:
b'{"[ERROR]": "PortChannel not configured!"}'
This will be the proper JSON output if port channel information have been configured.
b'{"1": {"ports": ["Ethernet1_1", "Ethernet2_1"]}}'
The below table has a list of output attributes:
Attribute | Values | Description |
---|---|---|
"ports" | ["EthernetX_X", ["EthernetY_Y"], | indicates port channels configured |
"comment" | "test" | additional port channel/device related comments |
Delete Port-channel information
Retrieves server port details
node.deletePortChannel(pch_id="1")