ADLINK aTCA-N700 User Manual

ADLINK Switch Manager
API Programming Guide
Manual Revision: 1.00 Revision Date: August 28, 2013 Part Number: 50-1G026-1000
Revision History
Rev Date Description
1.00 28/8/2013 Initial release
Switch Manager API Programming Guide
2
Switch Manager API Programming Guide

Preface

Copyright 2013 ADLINK Technology, Inc.
This document contains proprietary information protected by copyright. All rights are reserved. No part of this manual may be reproduced by any mechanical, electronic, or other means in any form without prior written permission of the manufacturer.
Disclaimer The information in this document is subject to change without prior notice in order to improve reliability , design, and fun ction and does not represent a commitm ent on the p art of the manufacturer. In no event will the manufacturer be liable for direct, indirect, special, incidental, or consequential damages arising out of the use or inability to use the product or documentation, even if advised of the possibility of such damages.
Environmental Responsibility
ADLINK is committed to fulfill its social responsibility to global environmental preservation through compliance with the European Union's Restriction of Hazardous Substances (RoHS) directive and Waste Electrical and Electronic Equipment (WEEE) directive. Environmental protection is a top priority for ADLINK. We have enforced measures to ensure that our products, manufacturing processes, components, and raw materials have as little impact on the environment as possible. When products are at their end of life, our customers are encouraged to dispose of them in accordance with the product disposal and/or recovery programs prescribed by their nation or company.
Trademarks
Product names mentioned herein are used for identification purposes only and may be trademarks and/or registered trademarks of their respective companies.
3
Switch Manager API Programming Guide
Table of Contents
Revision History.................................................................................................................... 2
Preface................................................................................................................................... 3
Table of Contents.................................................................................................................. 4
List of Figures.......................................................................................................................9
List of Tables.............................................................................Error! Bookmark not defined.
Introduction......................................................................................................................... 11
Architecture Overview........................................................................................................11
Deliverables......................................................................................................................... 12
Section 1: Base...................................................................................................................12
Enum Type........................................................................................................................ 12
status_t..........................................................................................................................12
Functions........................................................................................................................... 13
adlink_switch_chip_init ()...............................................................................................13
adlink_config_write ().....................................................................................................13
Section 2: VLAN.................................................................................................................. 14
Macro Definitions............................................................................................................... 14
MAX_VLAN_MAC_CNT ................................................................................................ 14
Enum Type........................................................................................................................ 14
adlink_vlan_tag_mode_t................................................................................................14
Data Structure...................................................................................................................14
adlink_vlan_info_t.......................................................................................................... 14
adlink_vlan_mac_t......................................................................................................... 15
Functions........................................................................................................................... 15
adlink_vlan_info_get ()................................................................................................... 15
adlink_vlan_admin_status_set ()...................................................................................16
adlink_vlan_create () ..................................................................................................... 16
adlink_vlan_destroy ().................................................................................................... 16
adlink_vlan_member_add ()..........................................................................................17
4
Switch Manager API Programming Guide
adlink_vlan_member_del () ........................................................................................... 17
adlink_port_default_vlan_set ()...................................................................................... 17
adlink_mac_based_vlan_add ().....................................................................................18
adlink_mac_based_vlan_del ()...................................................................................... 18
adlink_mac_based_vlan_get ()......................................................................................18
Section 3: Port..................................................................................................................... 19
Macro Definitions............................................................................................................... 19
MIN_FABRIC_PORT_ID ............................................................................................... 19
MAX_FABRIC_PORT_ID..............................................................................................19
MIN_BASE_PORT_ID................................................................................................... 19
MAX_BASE_PORT_ID..................................................................................................19
FABRIC_PORT_NUM ................................................................................................... 19
BASE_PORT_NUM....................................................................................................... 19
SWITCH_PORT_CPU................................................................................................... 19
FRONT_PANEL_XE_START........................................................................................ 19
FRONT_PANEL_XE_END............................................................................................ 19
TAPNAMSIZ..................................................................................................................20
Enum Type........................................................................................................................ 20
port_duplex_t................................................................................................................. 20
port_speed_t..................................................................................................................20
port_link_status_t........................................................................................................... 20
port_stp_state_t............................................................................................................. 21
port_vlan_filter_mode_mask_t....................................................................................... 21
port_rate_limit_mask_t .................................................................................................. 21
nic_config_mask_t......................................................................................................... 21
Data Structure...................................................................................................................22
adlink_port_info_t .......................................................................................................... 22
adlink_portstat_t ............................................................................................................ 22
adlink_set_port_status_cmd_t....................................................................................... 23
adl_nic_config_set_cmd_t.............................................................................................23
5
Switch Manager API Programming Guide
adl_nic_config_info_t..................................................................................................... 23
adl_nic_config_get_cmd_t............................................................................................. 24
Functions........................................................................................................................... 24
adlink_port_info_get ()................................................................................................... 24
adlink_port_status_set () ............................................................................................... 24
adlink_port_filter_mac_add ()........................................................................................25
adlink_port_filter_mac_del () ......................................................................................... 25
adlink_port_statistic_get ().............................................................................................25
adlink_port_statistic_clear ().......................................................................................... 25
adlink_nic_config_set ()................................................................................................. 26
adlink_nic_config_get()..................................................................................................26
adlink_port_pipe_get ().................................................................................................. 26
adlink_port_pipe_set()...................................................................................................26
adlink_port_pipe_clear()................................................................................................26
Section 4: Trunk..................................................................................................................27
Macro Definitions............................................................................................................... 27
MIN_TRUNK_ID............................................................................................................27
MAX_TRUNK_ID........................................................................................................... 27
MAX_TRUNK_MEMBER...............................................................................................27
Enum Type........................................................................................................................ 27
adlink_trunk_psc_t.........................................................................................................27
Data Structure...................................................................................................................28
adlink_trunk_monitor_t .................................................................................................. 28
Functions........................................................................................................................... 28
adlink_trunk_member_add ().........................................................................................28
adlink_trunk_member_del ().......................................................................................... 28
adlink_trunk_clear ()......................................................................................................29
adlink_trunk_mode_set ()..............................................................................................29
adlink_trunk_info_get ().................................................................................................29
adlink_trunk_monitor_add ().......................................................................................... 30
6
Switch Manager API Programming Guide
adlink_trunk_monitor_del ()...........................................................................................30
adlink_trunk_monitor_get ()........................................................................................... 30
Section 5: LAYER-2 ............................................................................................................ 31
Macro Definitions............................................................................................................... 31
MAC_SIZE.....................................................................................................................31
ADLINK_L2_xxx ............................................................................................................ 31
Enum Type........................................................................................................................ 31
Data Structure...................................................................................................................31
adlink_mac_entry_t........................................................................................................ 31
Functions........................................................................................................................... 32
adlink_mac_entry_add ()...............................................................................................32
adlink_mac_entry_del () ................................................................................................ 32
adlink_mac_table_clear ().............................................................................................. 32
adlink_mac_table_dump () ............................................................................................ 32
Section 6: ACL .................................................................................................................... 33
Macro Definitions............................................................................................................... 33
MAX_QUALIFIER_NUM................................................................................................33
Enum Type........................................................................................................................ 33
adlink_qualifier_type_t................................................................................................... 33
adlink_action_type_t...................................................................................................... 34
Data Structure...................................................................................................................34
adlink_acl_data_t...........................................................................................................34
adlink_acl_qualifier_info_t ............................................................................................. 35
adlink_acl_action_info_t ................................................................................................ 35
adlink_acl_rule_info_t.................................................................................................... 36
Functionsadlink_acl_rule_add ()....................................................................................36
adlink_acl_rule_delete ()................................................................................................ 36
adlink_acl_rule_clear ().................................................................................................. 37
adlink_acl_rule_get () .................................................................................................... 37
Section 7: Static Route.......................................................................................................38
7
Switch Manager API Programming Guide
Macro Definitions............................................................................................................... 38
MAX_ROUTE_ENTRY_ONE_TIME_GET .................................................................... 38
Enum Type........................................................................................................................ 38
Data Structure...................................................................................................................38
adlink_route_info_t ........................................................................................................ 38
Functions........................................................................................................................... 39
adlink_route_add ()........................................................................................................39
adlink_route_delete ().................................................................................................... 39
adlink_route_table_clear ()............................................................................................39
adlink_route_table_dump ()........................................................................................... 40
Getting Service.................................................................................................................... 41
8
Switch Manager API Programming Guide

List of Figures

Figure 1Hardware architecture for programming..........................................................11
9
Switch Manager API Programming Guide

List of Tables

Table 1- 1, Return Code Description...............................................................................13
Table 6- 1, Qualifier Type Description............................................................................. 34
Table 6- 2, Action Type Description................................................................................. 34
Table 6- 3, Data Descriptions For Different Qualifier Types............................................ 35
Table 6- 4, Data Descriptions for Different Action Types.................................................36
10
Switch Manager API Programming Guide
Introduction
This guide describes the how to program ADLINK Switch Management APIs on ADLINK's switch blades, such as the aTCA-3420, aTCA-N700, and aTCA-3710. Firstly, we will introduce the overall software architecture for programming. Secondly, we define the released deliverables, including header file, static library, binary files, example project and readme files. Finally, detailed API definitions and references will be provided to allow customers to easily program their own APIs.
Architecture Overview
All the APIs listed in this document are programmed using the following hardware architecture, shown in Figure 1. In this figure, the client is running on a standalone server. However, it also can run on the LMP on the switch blade.
Switch Manager
API Library
runs on client
Controller
Figure 1Hardware architecture for programming
The ADLINK Switch Manager implements the network connections between server and client so that customers do not have to worry about the connections between them. Provided are the client API libraries, header files and relevant documentation for easy programming.
Ethernet
Switch Manager
core service runs on
blade server with
switch chip
Blade Server
11
Switch Manager API Programming Guide
Deliverables
The ADLINK Switch Manager Library package (adSwitchLib-x.x.x.tar.gz) provides the following software components
Include: Header files of the ADLINK Switch Manager library Lib: Static library including the API functions listed in this document Bin: Binary files for controlling the switch system Example: ReadMe: The release notes for different library revisions
Application demo to show usage of the APIs provided

Section 1: Base

This section describes the macro, enum, struct and function for fundamentals. They are defined in the header file “adlink_api_base.h”.

Enum Type

status_t
typedef enum status { ADLINK_E_NONE = 0, /*no error*/ ADLINK_E_PARA = -1, /*parameter error*/ ADLINK_E_RESOURCE = -2, /*no available resource*/ ADLINK_E_EXIST = -3, /*item already exists*/ ADLINK_E_FIND = -4, /*item not found*/ ADLINK_E_SOCKET = -5, /*socket error*/ ADLINK_E_MALLOC = -6, /* mem allocation failed*/ ADLINK_E_OPEN = -7, /* open/fopen failed*/ ADLINK_E_OTHER = -8, /* Error other than above*/ //... ADLINK_E_SERVER_BASE = -128,/*base error code for server returned*/ }status_t;
This enum describes the return codes of the APIs. They are defined in “adlink_api_base.h”. Table 1-1 shows the meaning of each error code.
12
Switch Manager API Programming Guide
Table 1- 1, Return Code Description
Return Code Description ADLINK_E_NONE API run successfully ADLINK_E_PARA Parameter related error ADLINK_E_RESOURCE Table item overflow ADLINK_E_EXIST Table item already existing ADLINK_E_FIND Table item non-existentent ADLINK_E_SOCKET Error occurs when connecting to BCM server ADLINK_E_MALLOC Error occurs when memory allocation ADLINK_E_OPEN Error occurs when open/fopen a handle ADLINK_E_OTHER Other error ADLINK_E_SERVER_BASE For a meaningful error code form server, we return it with
this value added. So, if the returned code is less than this value, we can subtract this value and get the real return value from server. This is useful for debugging.

Functions

adlink_switch_chip_init ()
PROTOTYPE
int adlink_switch_chip_init(UINT32 server_ip)
DESCRIPTION
This function is used to init the switch chip.
PARAMETERS server_ip [IN] IP address of the server
RETURN See the description of status_t above.
adlink_config_write ()
PROTOTYPE
int adlink_config_write()
DESCRIPTION
This function is used to write the current configuration into file. After the function is called successfully, the configuration will still be in effect after the system reboots.
13
Loading...
+ 29 hidden pages