Dell PowerSwitch S6000 ON OpenSwitch OPX Developers Guide Release 2.1.0
Dell PowerSwitch S6000 ON Manual
View all Dell PowerSwitch S6000 ON manuals
Add to My Manuals
Save this manual to your list of manuals |
Dell PowerSwitch S6000 ON manual content summary:
- Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 1
OpenSwitch OPX Developers Guide Release 2.1.0 - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 2
2017 - 7 Rev. A02 - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 3
10 CPS keys...11 Objects and attributes...12 CPS qualifiers...13 Publish/subscribe...13 API operations...14 YANG modeling objects...15 Object dictionary support...15 YANG model C header...16 sFlow using YANG and Python...19 YANG model reference...19 CPS API Reference...20 3 Application examples...21 - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 4
model is defined using the YANG modeling language, and OpenSwitch OPX APIs support Python and C/C++. A set of standard Debian software development packages is provided object-centric application programming interface called the control plane service (CPS) application programming interface (API). The - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 5
of OpenSwitch OPX-specific software components. Control plane services Control plane services (CPS) is at the core of the the CPS server application that executes a requested operation. The CPS framework supports a publisher/subscriber mode, and server applications can publish relevant events, - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 6
abstraction interface (SAI) implements an API for network processor units (NPUs) supported on Dell EMC platforms. The SAI API is an open interface that Dell EMC engineers replace is the SAI. Network adaptation service The network adaptation service (NAS) manages the high-level NPU abstraction and - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 7
platform configuration parameters, such as the number of ports per system, supported transceiver modules, mapping of Linux interfaces to physical ports, and as hardware damage may result. Run-time components OpenSwitch OPX services • opx-cps - starts the CPS broker which mediates all operations and events • - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 8
port status (up/down) occurs, the NAS daemon propagates the new port status to the associated tap device. Packet I/O CPS services Packet I/O describes control plane packet forwarding between physical ports and associated Linux interfaces- implemented as a standalone thread of the NAS daemon - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 9
timing out and displays the Linux login prompt. Log in to OpenSwitch OPX and use the troubleshooting steps to determine the cause of the failure. You can use the systemctl command to determine if any services have failed, and the journalctl command to inspect the log contents. Getting started 9 - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 10
) infrastructure is at the core of system programmability. The CPS supports the definition of a well-defined, data-centric application programming interface (CPS API) that allows customer applications to interact with system services. System applications also use the CPS API to communicate with one - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 11
temperature threshold crossing events published by the OpenSwitch OPX platform adaptation service (PAS), and invoke a set request to change the request operations to be performed on objects-a set operation. The CPS service, which registers for the ownership of the specific object category, performs - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 12
attributes • Can embed other objects • Can be easily serialized-written to, read from, or a persistent or temporary storage device • Supports attribute types: • uint8_t • uint16_t • uint32_t • uint64_t • char [] • Attributes that contain other attributes Object attributes CPS object attributes are - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 13
) device. Applications can only use the target qualifier for create or set operations. In a get operation, an application can use any supported qualifier: target, observed, or real-time. Target qualifier Observed qualifier Real-time qualifier Indicates that the server application (object owner - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 14
event refers to. The key also indicates if the event represents a new object registration or deregistration. API operations The CPS infrastructure supports database-like requests for creating, updating, deleting, and retrieving one or more objects in a single operation. The CPS API defines the - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 15
API provides functions for: • Initialization of the CPS services in the context of the calling process • Key set, delete, create or action transaction-used when events are received. Object dictionary support The CPS object dictionary APIs access the metadata for each YANG model. The dictionary - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 16
dell-base-sflow"; prefix "base-sflow"; import dell-base-common { prefix "base-cmn"; } organization "Dell Inc"; contact "http://www.dell.com/support/softwarecontacts"; description "This module contains a collection of YANG definitions provided by platfrom to manage sflow objects"; revision 2014-02-11 - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 17
leaf id{ type uint32; description "Session id to uniquely identify a sflow session"; } leaf ifindex { type base-cmn:logical-ifindex; mandatory true; description "Interface index which uniquely identifies physical interface in the switch where packet sampling needs to to be enabled"; } leaf - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 18
* not use this file except in compliance with the License. You may obtain * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT * LIMITATION ANY - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 19
models to configure networking- and platform-related functions. These YANG models are defined by the network adaptation and platform adaptation services. • dell-base-acl.yang - access control lists (ACLs) • dell-base-common.yang - common definitions • dell-base-interface-common.yang - interfaces - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 20
-security.yang - port security protocols • dell-base-qos.yang - quality of service (QoS) • dell-base-routing.yang - routing protocols • dell-base-sflow.yang CPS API Reference To access the Python and C/C++ CPS API reference guides, see the README file in included with the software image. The YANG - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 21
contains links which describe how to write Python and C/C++ applications using the CPS API application examples. These links contain complete instructions, as well as links to directly view example application files. VLAN Python application examples IP address Python application examples Route - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 22
7 Verify the return value. ret = transaction.commit() if not transaction: raise RuntimeError ("Error creating Vlan") print "Successfully created" create_vlan.py #Python code block to create VLAN import cps import cps_object #Create CPS Object cps_obj = cps_object.CPSObject('dell-base-if-cmn/if/ - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 23
3 Define the VLAN interface name. VLAN_IF_NAME='br100' cps_obj.add_attr('if/interfaces/interface/name',VLAN_IF_NAME) 4 Define the untagged port to add to the VLAN. if_port_list=['e101-001-0'] cps_obj.add_attr('dell-if/if/interfaces/interface/untagged-ports',if_port_list) 5 Associate a set operation - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 24
dell-if/if/interfaces/interface/learning-mode = 1 if/interfaces/interface/enabled = 0 Verify VLAN port addition using Linux $ brctl show bridge name bridge id STP br100 8000.90b11cf4abee no enabled interfaces e101-001-0 e101-002-0 e101-003-0 Delete VLAN port using Python 1 Import the CPS - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 25
Key: 1.19.44.2883617.2883612.2883613. dell-base-if-cmn/if/interfaces/interface/if-index = 47 dell-if/if/interfaces/interface/phys-address = dell-if/if/interfaces/interface/untagged-ports = e101-002-0 base-if-vlan/if/interfaces/interface/id = 100 if/interfaces/interface/name = br100 dell-if/if/ - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 26
ret = transaction.commit() if not transaction: raise RuntimeError ("Error in deleting Vlan") print "successful" Verify VLAN deletion using CPS get # cps_get_oid.py dell-base-if-cmn/if/interfaces/interface if/interfaces/interface/ type=ianaift:l2vlan Key: 1.19.44.2883617.2883612.2883613. dell-base-if - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 27
#Verify return value ret = transaction.commit() if not ret: raise RuntimeError ("Error ") Verify IP address using CPS get # cps_get_oid.py 'base-ip/ipv4/address' Key: 1.34.2228241.2228246.2228236.2228240.2228228. base-ip/ipv4/address/prefix-length = 16 base-ip/ipv4/vrf-id = 0 base-ip/ipv4/name = - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 28
if not ret: raise RuntimeError ("Error ") Verify IP address Deletion using get (return indicates that e101-001-0 has no IP address) $ cps_get_oid.py 'base-ip/ipv4/address' Verify IP address deletion $ ip addr show e101-001-0 16: e101-001-0: mtu 1500 qdisc noop state DOWN group - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 29
obj.add_attr("af", socket.AF_INET6) ip = net.IPNetwork(route_ip) obj.add_attr_type("route-prefix", version) obj.add_attr("route-prefix", str(ip.network)) obj.add_attr("prefix-len", int(ip.prefixlen)) nh_addr = '1.1.1.2' lst = ["nh-list", "0", obj.add_embed_attr(lst, obj.add_attr("nh-count", print - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 30
obj = cps_utils.CPSObject('base-route/obj/entry') obj.add_attr("vrf-id", 0) if version == 'ipv4': obj.add_attr("af", socket.AF_INET) elif version == 'ipv6': obj.add_attr("af", socket.AF_INET6) ip = net.IPNetwork(route_ip) obj.add_attr_type("route-prefix", version) obj.add_attr("route-prefix", str(ip - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 31
#Define enum map e_stg = {'INGRESS': 1, 'EGRESS': 2} e_ftype = {'SRC_MAC': 3, 'DST_MAC': 4, 'SRC_IP': 5, 'DST_IP': 6, 'IN_PORT': 9, 'DSCP': 21} e_atype = {'PACKET_ACTION': 3, 'SET_TC': 10} e_ptype = {'DROP': 1} #Tell CPS utility about the type of each attribute type_map = { 'base-acl/entry/ - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 32
9 Retrieve the CPS object ID from the ACL table - this ID is used for all operations on the ACL table. ret = cps_utils.CPSObject (module='base-acl/table', obj=r[0]['change']) tbl_id = cps_get_val.get_attr_data ('id') print "Successfully created ACL Table " + str(tbl_id) create-acl.py #Python code - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 33
Create ACL entry using Python An ACL entry is a rule that consists of a set of filters that define packets to be matched, and a set of actions to be performed on the matched packets. 1 Import the CPS utility Python library. import cps_utils import nas_os_utils 2 Define the enum map. NOTE: A CPS - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 34
10 Verify the return value. ret = cps_trans.commit() if not ret: raise RuntimeError ("Error creating MAC ACL Entry") 11 Retrieve the CPS object ID from the ACL table. This ID is used for all operations on the ACL table. cps_get_val = cps_utils.CPSObject (module='base-acl/entry', obj=r[0]['change']) - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 35
#Filters #Match Filter 1 - Src MAC cps_obj.add_embed_attr (['match','0','type'], e_ftype['SRC_MAC']) #The 2 at the end indicates that the type should be deducted from the last 2 attrs (SRC_MAC_VALUE,addr) cps_obj.add_embed_attr (['match','0','SRC_MAC_VALUE','addr'], '50:10:6e:00:00:00', 2) #Match - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 36
NOTE: A CPS Python application does not automatically map the YANG model enum name to a number. e_stg = {'INGRESS': 1, 'EGRESS': 2} e_ftype = {'SRC_MAC': 3, 'DST_MAC': 4, 'SRC_IP': 5, 'DST_IP': 6, 'IN_PORT': 9, 'DSCP': 21} e_atype = {'PACKET_ACTION': 3, 'SET_TC': 10} e_ptype = {'DROP': 1} 3 Register - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 37
5 Add the operation to the object. tr_obj = ('create', obj.get()) 6 Create a transaction object. transaction = cps_utils.CPSTransaction([tr_obj]) 7 Verify the return value. ret = transaction.commit() if not ret: raise RuntimeError ("Error creating MAC Table Entry") create-mac-table-entry.py #Python - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 38
cps_api_transaction_close(&tran); return false; } // Set the key for the object cps_api_object_set_key(obj,&key); // Add attributes mandatory to create MAC address entry uint8_t mac_addr[6] = {0x0,0xa,0xb,0xc,0xd,0xe}; uint16_t vlan_id = 100; cps_api_object_attr_add(obj,BASE_MAC_TABLE_MAC_ADDRESS, - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 39
#Create CPS object obj = cps_utils.CPSObject('base-mac/table',data=d) #Add operation to object tr_obj = ('delete', obj.get()) #Create transaction object transaction = cps_utils.CPSTransaction([tr_obj]) #Verify return value ret = transaction.commit() if not ret: raise RuntimeError("Error deleting - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 40
ifindex attributes and their values in the object. NOTE: Deletion of static entries based only on VLAN, interface or a VLAN/interface combination is not supported. To delete a static entry, you must add the mac-address, vlan, and ifindex attributes and their values to the object. Delete MAC address - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 41
#Verify return value ret = transaction.commit() if not ret: raise RuntimeError("Error Flushing entries from MAC Table") remove-mac-table-entries-from-multiple-vlans.c // C application example to remove MAC address table entries from multiple VLANs #include #include #include #include " - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 42
.py #Python block code to register for events import cps #Create handle to connect to event service handle = cps.event_connect() #Register key with event service cps.event_register(handle, cps.key_from_name('observed','base-port/interface')) while True: o = cps.event_wait(handle) print o register - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 43
Publish events 1 Import the CPS and CPS utlity Python library. import cps import cps_utils 2 Create a handle to connect to the event service. handle = cps.event_connect() 3 Create a CPS object. obj = cps_utils.CPSObject('dell-base-if-cmn/if/interfaces/interface',qual='observed', data= {"ifindex":23 - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 44
#Create CPS object obj = cps_utils.CPSObject('base-port/interface',qual='observed', data= #Publish the object cps.event_send(handle, obj.get()) {"ifindex":23}) publish-events.c // C application example to publish events #include #include #include #include #include "cps_api_events.h" " - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 45
4 Application templates Provided are templates to develop applications in Python and C/C++ for server and client applications, and event publishers and event subscribers. Client applications subscribe to events-server applications publish events, and applications can act as both clients and servers. - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 46
of a CPS event publisher including initialization of the event service, connection to the object library, and the event publish for the structure of a CPS event subscriber including initialization of the event service and event processing thread, and registration of the event handler function, and - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 47
run while True: time.sleep(1000) c-template-server-application.c Template CPS API object server read handler function This function is invoked by the CPS API service when a GET request is placed for a registered CPS API object. The binding of CPS API object key to the read handler function is done - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 48
) { /* Extract the object given in the request */ cps_api_object_t request_obj; request_obj = cps_api_object_list_get( param->change_list, index_of_element_being_updated ); if (request_obj == CPS_API_OBJECT_NULL) { /* Failed to extract request object => Indicate error */ return (cps_api_ret_code_ERR - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 49
/* Extract the attribute from the request object */ cps_api_object_attr_t attr; attr = cps_api_object_attr_get(request_obj, attr_id); if (attr == CPS_API_ATTR_NULL)) { /* Failed to extract attribute => Indicate error */ result = cps_api_ret_code_ERR; continue; } /* Extract the value of the - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 50
(result); } Template mainline function for a CPS API object server This function registers with the CPS API service, and registers handler functions to be invoked by the CPS API service when CPS API requests are made for certain CPS API objects cps_api_return_code_t init(void) { /* Obtain - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 51
reg._read_function = xyz_read; reg._write_function = xyz_write; reg._rollback_function = xyz_rollback; /* Use obtained handle for CPS API service */ reg.handle = cps_hdl; /* Perform the object registration */ if (cps_api_register(®) != cps_api_ret_code_OK) { /* Failed to register handler - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 52
/* Assume failure response */ cps_api_return_code_t result = cps_api_ret_code_ERR; do { /* Allocate the request object and add it to the get request */ cps_api_object_t request_obj; request_obj = cps_api_object_list_create_obj_and_append( get_req.filters ); if (request_obj == CPS_API_OBJECT_NULL) { - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 53
/* Do something with the extracted value */ /* Indicate success */ result = cps_api_ret_code_OK; } while (0); cps_api_get_request_close(&get_req); return (result); } Template to perform CPS API SET cps_api_return_code_t do_set_request() { cps_api_transaction_params_t xact ; if ( - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 54
application templates This information includes templates for the structure of a CPS event subscriber. It illustrates the initialization of the event service and event processing thread, registration of the event handler function and event processing callback. The key list specified in the - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 55
something with that information */ } cps_api_return_code_t event_subscribe() { /* Connect to CPS API event service */ if (cps_api_event_service_init() != cps_api_ret_code_OK) { return (cps_api_ret_code_ERR); } if (cps_api_event_thread_init() != cps_api_ret_code_OK) { return (cps_api_ret_code_ERR - Dell PowerSwitch S6000 ON | OpenSwitch OPX Developers Guide Release 2.1.0 - Page 56
tag or express service code, pull out the luggage tag on the chassis or enter the show chassis command from the CLI. • To receive additional kinds of technical support, click Contact Us, then click Technical Support. To access system documentation, see www.dell.com/manuals/. To search for drivers
OpenSwitch OPX Developers Guide
Release 2.1.0